infernu icon indicating copy to clipboard operation
infernu copied to clipboard

Represent var hoisting properly

Open sinelaw opened this issue 9 years ago • 0 comments

Currently, some statements that include possible var declarations are treated as locally / block scoped. This is nice but wrong - JS doesn't have block scopes. We can to find all var declarations in each function and introduce them in the function's scope (but they would be uninitialized).

Alternatively, pretend block scoping exists and prevent bugs by throwing errors if the variable is accessed outside the block elsewhere in the function.

sinelaw avatar Jun 15 '15 19:06 sinelaw