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

Default parameters intermediate scope #1376

Open
UltCombo opened this issue Sep 24, 2014 · 1 comment
Open

Default parameters intermediate scope #1376

UltCombo opened this issue Sep 24, 2014 · 1 comment

Comments

@UltCombo
Copy link
Contributor

@UltCombo UltCombo commented Sep 24, 2014

Adapted test case from this article:

var x = 1;

function foo(x, y = function() { x = 2; }) {
  var x = 3;
  y();
  assert.equal(x, 3); // fails in Traceur
}

foo();
assert.equal(x, 1);

As far as I can see, Traceur does not implement an intermediate scope for default parameters. Has the TC39 changed this behavior, or is this simply a missing feature in Traceur?

@arv
Copy link
Collaborator

@arv arv commented Sep 25, 2014

Yeah, traceur does not do the right thing.

One idea is that if we implement this then we could skip the extra scope if the initializers do not refer to an of the parameters.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.