aboutsummaryrefslogtreecommitdiff
path: root/src/js_parser.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-27 09:40:29 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-27 09:40:29 -0700
commita8ab18bd50b3a98c65c6ce96bd75d87d7893df12 (patch)
tree81339f8f0aa3e5ecf8bd493cb74ee1c4b04e30a4 /src/js_parser.zig
parentce91423a196b371a250dd492fbb63ea0bff96a9d (diff)
downloadbun-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.zig8
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) {