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

Object destructuring fails when not declaring variable inline #290

Closed
jdom opened this issue Jan 5, 2022 · 3 comments
Closed

Object destructuring fails when not declaring variable inline #290

jdom opened this issue Jan 5, 2022 · 3 comments

Comments

@jdom
Copy link
Contributor

jdom commented Jan 5, 2022

The following code:

let foo, bar;
({foo, bar} = {foo: 42, bar: true});

becomes:

let foo,bar;({foo,bar})={foo:42,bar:!0}

Expected:

let foo,bar;({foo,bar}={foo:42,bar:!0})

Notice how the closing parenthesis (which are required here in javascript, since it's not declaring and initializing the variable inline) were shifted from enclosing the whole assignment, to just enclosing the left-hand side of the destructuring expression (which is wrong). The expected minified code is:

let foo,bar;({foo,bar}={foo:42,bar:!0})

Nevertheless the following minifies correctly:

const {foo, bar} = {foo: 42, bar: true};

Becomes:

const{foo,bar}={foo:42,bar:!0}
@trullock
Copy link
Owner

fixed in 1.17.9

@jdom
Copy link
Contributor Author

jdom commented Jan 14, 2022

w00t! thanks for fixing it! I started troubleshooting but this one was a little bit more complex than other bugs I fixed. Thanks again

@trullock
Copy link
Owner

i mean, dont look at the code its a diabolical hack haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants