This issue only appears if the let declaration is inside a block. If it is a direct child of a function body/program, babel throws correctly.
REPL
Input Code
Expected Behavior
Duplicate declaration "a"
Current Behavior
No error
Possible Solution
Scope should check the block scopes that variable declarations visit while they "walk up" the scope.
It should also keep track of them, in the case that the variable declaration comes before the lexical declaration (e.g. { { var a; }; let a; })
Your Environment
| software |
version(s) |
| Babel |
7.0.0-beta.1 |
| node |
|
| npm |
|
| Operating System |
|
This issue only appears if the let declaration is inside a block. If it is a direct child of a function body/program, babel throws correctly.
REPL
Input Code
Expected Behavior
Current Behavior
No error
Possible Solution
Scopeshould check the block scopes that variable declarations visit while they "walk up" the scope.It should also keep track of them, in the case that the variable declaration comes before the lexical declaration (e.g.
{ { var a; }; let a; })Your Environment