diff --git a/crates/oxc_minifier/src/ast_passes/peephole_substitute_alternate_syntax.rs b/crates/oxc_minifier/src/ast_passes/peephole_substitute_alternate_syntax.rs index 9e2b1f1965b8e..8d5ebf3ff5e05 100644 --- a/crates/oxc_minifier/src/ast_passes/peephole_substitute_alternate_syntax.rs +++ b/crates/oxc_minifier/src/ast_passes/peephole_substitute_alternate_syntax.rs @@ -1520,6 +1520,10 @@ mod test { test("x && (x = g())", "x &&= g()"); test("x ?? (x = g())", "x ??= g()"); + // `||=`, `&&=`, `??=` sets the name property of the function + // Example case: `let f = false; f || (f = () => {}); console.log(f.name)` + test("x || (x = () => 'a')", "x ||= () => 'a'"); + test_same("x || (y = 3)"); // foo() might have a side effect