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

let + for-of does not respect scoping #159

Closed
monsanto opened this issue Nov 14, 2014 · 6 comments
Closed

let + for-of does not respect scoping #159

monsanto opened this issue Nov 14, 2014 · 6 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@monsanto
Copy link
Contributor

Minimal example:

let x = [0]
for (let x of x) {
    console.log(x)
}
console.log(x)
$ 6to5-node test.js
0
0
$ traceur test.js
0
[ 0 ]
@monsanto monsanto changed the title let + for-of does not respect block scoping let + for-of does not respect scoping Nov 14, 2014
@sebmck
Copy link
Contributor

sebmck commented Nov 14, 2014

Odd. This should be working, I'll investigate shortly.

@sebmck
Copy link
Contributor

sebmck commented Nov 14, 2014

This seems to transform correctly.

function foo() {
  var x = [0]
  for (let x of x) {
    console.log(x)
  }
  console.log(x)
}

foo();

Looks like a pretty serious bug I'll have to track down.

@monsanto
Copy link
Contributor Author

@sebmck the example you just posted doesn't work for me, unless you are saying that you have just made fixes so it does

(I'm using 1.12.10)

@sebmck
Copy link
Contributor

sebmck commented Nov 14, 2014

@monsanto I must have inadvertently fixed it kinda-ish when debugging. I'll have to write a lot more let scoping tests, Traceur's coverage doesn't seem to be enough.

@sebmck
Copy link
Contributor

sebmck commented Nov 14, 2014

Looks like it's an issue with the scope tracking not tracking node position changes.

@sebmck
Copy link
Contributor

sebmck commented Nov 14, 2014

Thanks! Fixed as of 1.12.12

@sebmck sebmck closed this as completed Nov 14, 2014
@sebmck sebmck added the bug label Nov 14, 2014
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jan 19, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

2 participants