SIGN IN SIGN UP

feat(minifier): expand de morgan's optimization to allow move of `!` (#25930)

Expand negation to include move of `!` operator to inner children

```js
!(a == b && c == 3 && a)
a != b || c != 3 | !a
```

delta calculation is dependent on boolean context
- if we expect truthly/falsly value negation of `!a` will be converted
to `a` (-1 delta)
- in ambiguous context `!a` will be converted to `!!a` (+1 delta)

```js
a = !!(!b || !c);
//   ^ ^     ^ -3
a = !(b || c)
//  ^ ^    ^ +1 - if we could detect if parens can be removed it would be -1
//  ^^^    ^^ -1 - if we would know that we can remove parens
```
A
Armano committed
3ed4f6ad909489372e4f8fbef6ad9e6bb3ce068a
Parent: baf4b1e
Committed by GitHub <noreply@github.com> on 8/28/2026, 6:08:57 PM