infernu
infernu copied to clipboard
Represent var hoisting properly
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.