From b9c3db7ff914cd0c50b2ac680c35e2fbf58a0498 Mon Sep 17 00:00:00 2001 From: dave caruso Date: Sat, 19 Aug 2023 13:10:43 -0700 Subject: fix minified "\n".length --- src/js_lexer.zig | 6 ++---- test/bundler/bundler_minify.test.ts | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js_lexer.zig b/src/js_lexer.zig index 1417ea01e..b38080b8e 100644 --- a/src/js_lexer.zig +++ b/src/js_lexer.zig @@ -639,6 +639,7 @@ fn NewLexer_( stringLiteral: while (true) { switch (lexer.code_point) { '\\' => { + needs_slow_path = true; lexer.step(); // Handle Windows CRLF @@ -662,12 +663,9 @@ fn NewLexer_( // 0 cannot be in this list because it may be a legacy octal literal 'v', 'f', 't', 'r', 'n', '`', '\'', '"', '\\', 0x2028, 0x2029 => { lexer.step(); - continue :stringLiteral; }, - else => { - needs_slow_path = true; - }, + else => {}, } }, // This indicates the end of the file diff --git a/test/bundler/bundler_minify.test.ts b/test/bundler/bundler_minify.test.ts index 17286f6b8..5c77e70e6 100644 --- a/test/bundler/bundler_minify.test.ts +++ b/test/bundler/bundler_minify.test.ts @@ -27,6 +27,7 @@ describe("bundler", () => { capture(\`😋📋👌\`.length == 6) capture(\`😋📋👌\`.length === 2) capture(\`😋📋👌\`.length == 2) + capture("hello\\nworld".length) `, }, capture: [ @@ -50,6 +51,7 @@ describe("bundler", () => { "!0", "!1", "!1", + "11", ], minifySyntax: true, target: "bun", -- cgit v1.2.3