You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it easy to add support for ES6 block scoping for let and const?
It's somewhat meaningless (and even confusing) to have let and const but no block scoping for them, because it's the main difference between them and var.
You would need to expand the Scope class to track both the block scope, and the function scope. This gets a little tricky when things like declaring a let inside a for loop deceleration is considered.
Activity
basicer commentedon Jun 23, 2018
It's not so hard.
You would need to expand the Scope class to track both the block scope, and the function scope. This gets a little tricky when things like declaring a let inside a for loop deceleration is considered.
It's on my TODO list for sure.
basicer commentedon Jul 5, 2018
I added some support for this in 268909e, but it needs some testing. Let me know what you think.
ngocdaothanh commentedon Jul 5, 2018
Thanks for working on this feature!
I've tried the code at #16 again, but it still doesn't work as expected.
To make it work as expected, I still need to change this line:
to:
ngocdaothanh commentedon Feb 7, 2019
Hi, is PR #20 "Closure fixes" for fixing this issue?
basicer commentedon Feb 7, 2019
It improves the situation but does not fix it entirely.