Default parameters intermediate scope #1376

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

Comments

Projects
None yet
2 participants
@UltCombo
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@arv

arv Sep 25, 2014

Collaborator

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.

Collaborator

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