Closed JonAbrams closed 11 years ago
Closing this issue, as using variables before they are defined is in general an anti-pattern.
That's not a good reason to close this. This could lead to deceptive highlighting, where an accidentally shadowed reference is highlighted as if it wasn't.
Hmmm I see your point, I wonder if you could use the lint warning information to correct the coloring.
Just do real scope analysis instead of this naive scanner approach. See Constellation/escope.
I'll try a better example. Is this an anti-pattern?
Example taken from: http://stackoverflow.com/questions/8597501/which-design-patterns-take-advantage-of-javascripts-hoisting-behavior
First of all, this project is absolutely brilliant, great job!
The issue: If I have code in a function that references a variable from the parent scope that's declared after the function, it doesn't get coloured correctly.
For example (the variable late belongs to the 'white' scope not the 'green' scope):