You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The precedence of bitwise operations (at least for NOT) is not taken into account when compiling. Wrapping parentheses around an expression in the source code does nothing in the compiled Javascript.
Input code (Typescript)
constn=~~(Math.PI*10)// n = 31; Multiplication is done first and the then double bitwise NOT operation.
Output code (Javascript)
varn=~~Math.PI*10;// n = 30; The double bitwise NOT operation is done first and then multiplication.
swc_ecma_transforms_base:
- `fixer`: Wrap operand of a unary expression if it's a binary expression. (#1781, #1789)
swc_ecma_transforms_module:
- Allow multiple `export *` even if it has the same item. (#1780)
kdy1
added a commit
to kdy1/swc
that referenced
this issue
Jul 19, 2021
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Describe the bug
The precedence of bitwise operations (at least for NOT) is not taken into account when compiling. Wrapping parentheses around an expression in the source code does nothing in the compiled Javascript.
Input code (Typescript)
Output code (Javascript)
Config
Expected behavior
The parenthesis around the expression should remain and not be omitted in compilation.
Version
The version of @swc/core: 1.2.59
The text was updated successfully, but these errors were encountered: