mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
test(minifier): add anonymous function test case for logical expression to logical assignment compression (#8347)
Added a test case that tells having an anonymous function on the right hand side for "logical expression to logical assignment" compression is fine.
This commit is contained in:
parent
9a5c66ac6a
commit
3149fe0aa4
1 changed files with 4 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue