diff options
author | 2022-09-27 09:40:29 -0700 | |
---|---|---|
committer | 2022-09-27 09:40:29 -0700 | |
commit | a8ab18bd50b3a98c65c6ce96bd75d87d7893df12 (patch) | |
tree | 81339f8f0aa3e5ecf8bd493cb74ee1c4b04e30a4 /src/js_parser.zig | |
parent | ce91423a196b371a250dd492fbb63ea0bff96a9d (diff) | |
download | bun-a8ab18bd50b3a98c65c6ce96bd75d87d7893df12.tar.gz bun-a8ab18bd50b3a98c65c6ce96bd75d87d7893df12.tar.zst bun-a8ab18bd50b3a98c65c6ce96bd75d87d7893df12.zip |
Fix potential crash when TS code has an unexpected ")"
Diffstat (limited to 'src/js_parser.zig')
-rw-r--r-- | src/js_parser.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig index e1d613be5..052edc6b1 100644 --- a/src/js_parser.zig +++ b/src/js_parser.zig @@ -8716,10 +8716,10 @@ fn NewParser_( try p.skipTypeScriptType(.lowest); } - // If we end with a .t_close_paren, that's a bug. It means we aren't following the last parenthese - - if (comptime Environment.allow_assert) - assert(p.lexer.token != .t_close_paren); + if (p.lexer.token == .t_close_paren) { + p.log.addRangeError(p.source, p.lexer.range(), "Unexpected \")\"") catch unreachable; + return error.SyntaxError; + } } if (p.lexer.token == .t_equals) { |