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

FIX: Transform default values correctly in destructuring #1708

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

0xe
Copy link
Contributor

@0xe 0xe commented Oct 22, 2024

Default values for destructuring assignments weren't transformed correctly. Partially addresses #1641.

For example, all of these expressions with default values were not being evaluated correctly:

function a() { return 12;};  function b([x = a()] = []) { return x }; b()
function a() { return 12;};  function b([x = a()] = [1]) { return x }; b()
function a() { return 12;};  function b([x = 1] = [a()]) { return x }; b()
var a = { p1: { p2: 121}}; function b([x = a.p1.p2] = []) { return x }; b()
function a() { return 12;};  function b({x = a()} = {}) { return x }; b()
function a() { return 12;};  function b({x = a()} = {x: 1}) { return x }; b()
var a = { p1: { p2: 121}}; function b({x = a.p1.p2} = {}) { return x }; b()
function a() { return 12;};  function b({x = 1} = {x: a()}) { return x }; b()

@0xe 0xe force-pushed the scratch/satish/destructuring-defaults-1641 branch from 808f2c3 to 5ffcfe4 Compare October 22, 2024 19:01
@0xe 0xe marked this pull request as ready for review October 22, 2024 19:11
@rbri
Copy link
Collaborator

rbri commented Oct 22, 2024

the number of fixed tests is really impressive.good job.

@gbrail
Copy link
Collaborator

gbrail commented Oct 23, 2024

This is great -- thanks!

@gbrail gbrail merged commit e8b23f5 into mozilla:master Oct 23, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants