aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-08-19 13:10:43 -0700
committerGravatar dave caruso <me@paperdave.net> 2023-08-19 13:10:43 -0700
commitb9c3db7ff914cd0c50b2ac680c35e2fbf58a0498 (patch)
tree75b26472663b6c4bc328498fb349a11f2409e842
parent86ad0151479c96314233c2d7dfbf7ed83b57feab (diff)
downloadbun-b9c3db7ff914cd0c50b2ac680c35e2fbf58a0498.tar.gz
bun-b9c3db7ff914cd0c50b2ac680c35e2fbf58a0498.tar.zst
bun-b9c3db7ff914cd0c50b2ac680c35e2fbf58a0498.zip
fix minified "\n".length
-rw-r--r--src/js_lexer.zig6
-rw-r--r--test/bundler/bundler_minify.test.ts2
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",