Open ngocdaothanh opened 6 years ago
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.
I added some support for this in 268909e704034d8f5ed95095a17c8b80689d18cb, but it needs some testing. Let me know what you think.
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:
const char = string[i]
to:
let char = string[i]
Hi, is PR #20 "Closure fixes" for fixing this issue?
It improves the situation but does not fix it entirely.
(Related to #15 and #16)
Is it easy to add support for ES6 block scoping for
let
andconst
?It's somewhat meaningless (and even confusing) to have
let
andconst
but no block scoping for them, because it's the main difference between them andvar
.