diff options
author | 2023-05-18 13:27:05 -0700 | |
---|---|---|
committer | 2023-05-18 13:27:05 -0700 | |
commit | f3a1a3bb2bee56940426a6541c46775a2f8ab28a (patch) | |
tree | 2e7afa31e566b16feed02d4d3bcef666377768fd /src/js_parser.zig | |
parent | 755c0d62c47b0e8301a3d975697d476fe5c7436f (diff) | |
download | bun-f3a1a3bb2bee56940426a6541c46775a2f8ab28a.tar.gz bun-f3a1a3bb2bee56940426a6541c46775a2f8ab28a.tar.zst bun-f3a1a3bb2bee56940426a6541c46775a2f8ab28a.zip |
Fixes #2946 (#2949)
* Fixes #2946
* Update string_mutable.zig
* Fixes #2948
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js_parser.zig')
-rw-r--r-- | src/js_parser.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig index 90d7a5d24..ee6a5e6b8 100644 --- a/src/js_parser.zig +++ b/src/js_parser.zig @@ -20389,7 +20389,10 @@ fn NewParser_( var decl = &prev_local.decls.slice()[0]; if (decl.binding.data == .b_identifier and decl.binding.data.b_identifier.ref.eql(bin_assign.left.data.e_identifier.ref) and - (decl.value == null or decl.value.?.isPrimitiveLiteral())) + // If the value was assigned, we shouldn't merge it incase it was used in the current statement + // https://github.com/oven-sh/bun/issues/2948 + // We don't have a more granular way to check symbol usage so this is the best we can do + decl.value == null) { decl.value = bin_assign.right; p.ignoreUsage(bin_assign.left.data.e_identifier.ref); |