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

Spread and destructor adds erroneous parenthesis. #52

Open
Naddiseo opened this issue Sep 15, 2014 · 0 comments · May be fixed by #53
Open

Spread and destructor adds erroneous parenthesis. #52

Naddiseo opened this issue Sep 15, 2014 · 0 comments · May be fixed by #53

Comments

@Naddiseo
Copy link

Test case:

var p = [];
var [a,b] = Object(...p);

Partial output:

// .... Snip....
var p = [];
var a = (b = Object.apply(null, ITER$0(p))[0], b = b[1]);

As you can see from the output, the initializer for a is wrapped in parenthesis, which causes b = b[1] to not be part of the var declaration, thus, b is never defined.

Side question: what is the reasoning behind doing the destructoring this way instead of similar to how traceur does it with a temporary?

 var p = [];
  var $__27 = Object.apply(null, $traceurRuntime.spread(p)),
      a = $__27[0],
      b = $__27[1];
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 a pull request may close this issue.

1 participant