From a8ab18bd50b3a98c65c6ce96bd75d87d7893df12 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Tue, 27 Sep 2022 09:40:29 -0700 Subject: Fix potential crash when TS code has an unexpected ")" --- src/js_parser.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3