diff --git a/CHANGES.md b/CHANGES.md index 40203adabd..9350137f15 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# 5.8.2 (2024-05-24) - Luc + +## Bug fixes +* Compiler: fix variable renaming for property binding and assignment target (part 2) + # 5.8.1 (2024-05-05) - Lille ## Features/Changes diff --git a/compiler/lib/js_traverse.ml b/compiler/lib/js_traverse.ml index eb62308b7e..aea066c1e9 100644 --- a/compiler/lib/js_traverse.ml +++ b/compiler/lib/js_traverse.ml @@ -1351,7 +1351,7 @@ class rename_variable ~esm = when StringMap.mem name' subst -> let x = Prop_binding (PNI name, (BindingIdent ident, e)) in super#binding_property x - | x -> x + | x -> super#binding_property x method expression e = match e with diff --git a/compiler/tests-compiler/minify.ml b/compiler/tests-compiler/minify.ml index 54424d3d29..ae8dd099ef 100644 --- a/compiler/tests-compiler/minify.ml +++ b/compiler/tests-compiler/minify.ml @@ -471,4 +471,16 @@ function h(x) { 1: function 2: h(a){var 3: b;for({toto:b}in - 4: a)console.log(b)} |}]) + 4: a)console.log(b)} |}]; + minify + {| +function h(f) { + var { toto : c} = f(); + console.log({ toto : c }); +} +|}; + [%expect + {| + $ cat "test.min.js" + 1: function + 2: h(a){var{toto:b}=a();console.log({toto:b})} |}])