diff options
author | 2023-05-12 08:32:24 -0700 | |
---|---|---|
committer | 2023-05-12 08:32:24 -0700 | |
commit | 5f897589fc3cb7a705f4db8462cebedc316b73f5 (patch) | |
tree | c64871368b589602754eeecdb929bd831f333cd4 | |
parent | 4d5d0d075a597400175d410db8b8dcfcc8016623 (diff) | |
download | bun-5f897589fc3cb7a705f4db8462cebedc316b73f5.tar.gz bun-5f897589fc3cb7a705f4db8462cebedc316b73f5.tar.zst bun-5f897589fc3cb7a705f4db8462cebedc316b73f5.zip |
disable sloppy mode block level functions when not bundling (#2864)
* enable only during bundling
* add `willUseNumberRenamer()`
-rw-r--r-- | src/js_parser.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig index bf73f0491..18cf241a6 100644 --- a/src/js_parser.zig +++ b/src/js_parser.zig @@ -6670,6 +6670,10 @@ fn NewParser_( // p.resolveGeneratedSymbol(&p.jsx_filename); } + fn willUseNumberRenamer(p: *P) bool { + return p.options.bundle; + } + fn hoistSymbols(p: *P, scope: *js_ast.Scope) void { if (!scope.kindStopsHoisting()) { var iter = scope.members.iterator(); @@ -6720,7 +6724,8 @@ fn NewParser_( var is_sloppy_mode_block_level_fn_stmt = false; const original_member_ref = value.ref; - if (symbol.kind == .hoisted_function) { + // TODO: always use the number renamer + if (p.willUseNumberRenamer() and symbol.kind == .hoisted_function) { // Block-level function declarations behave like "let" in strict mode if (scope.strict_mode != .sloppy_mode) { continue; |