Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler does not put parentheses around logical OR operator when extending optional class #10487

Closed
wrnrlr opened this issue May 4, 2021 · 3 comments · Fixed by #10867
Closed
Labels
bug Something isn't working correctly fix available there is a fix available in a third party library that needs to be merged swc related to swc (bundling/transpiling)

Comments

@wrnrlr
Copy link

wrnrlr commented May 4, 2021

For example:

This:

var generator = class MultiVector extends (options.baseType||Float32Array) {

turns into this:

var generator = class MultiVector extends options1.baseType || Float32Array {

Spotted in the wild:
https://github.com/enkimute/ganja.js/blob/master/ganja.js#L146

@wrnrlr
Copy link
Author

wrnrlr commented May 4, 2021

Not going to create new ticket for it, but similar problems occurs when the unary operator (-) is used before an exponentiation the parentheses are removed:

https://github.com/enkimute/ganja.js/blob/master/ganja.js#L617

@kitsonk kitsonk added bug Something isn't working correctly swc related to swc (bundling/transpiling) labels May 4, 2021
@kitsonk
Copy link
Contributor

kitsonk commented May 4, 2021

cc/ @kdy1

kdy1 added a commit to kdy1/swc that referenced this issue May 4, 2021
kdy1 added a commit to swc-project/swc that referenced this issue May 4, 2021
…pr (#1636)

swc_ecma_transforms_base:
 - Handle binary expressions in super class expressions. (denoland/deno#10487)
@kdy1
Copy link

kdy1 commented May 4, 2021

Fixed on upstream. cargo update -p swc_ecma_transforms_basewill fix the issue.

@lucacasonato lucacasonato added the fix available there is a fix available in a third party library that needs to be merged label May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly fix available there is a fix available in a third party library that needs to be merged swc related to swc (bundling/transpiling)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants