Open limsbeheer opened 1 year ago
NUglify version: 1.20.7 Reproduced in tiny console app in .NET 7.0
Describe the bug When using ?? in combination with || the necessary parentheses are removed in the minified code.
??
||
To Reproduce Uglify.Js("if ((a ?? b ?? c) || await d()) {}");
Uglify.Js("if ((a ?? b ?? c) || await d()) {}");
Minified output or stack trace Output code: a??b??c||await d() which results in the JavaScript exception Uncaught SyntaxError: Unexpected token '||'.
a??b??c||await d()
Uncaught SyntaxError: Unexpected token '||'
Expected output code (a??b??c)||await d() The parentheses around a??b??c cannot be removed.
(a??b??c)||await d()
It's probably treating the operator precedence for ?? the same as ||.
You can easily change this, make a PR
NUglify version: 1.20.7 Reproduced in tiny console app in .NET 7.0
Describe the bug When using
??
in combination with||
the necessary parentheses are removed in the minified code.To Reproduce
Uglify.Js("if ((a ?? b ?? c) || await d()) {}");
Minified output or stack trace Output code:
a??b??c||await d()
which results in the JavaScript exceptionUncaught SyntaxError: Unexpected token '||'
.Expected output code
(a??b??c)||await d()
The parentheses around a??b??c cannot be removed.