tern
tern copied to clipboard
Scopes are wrong
trafficstars
I passed this code in tern and used infer.scopeAt to find scope var y = 2 line
function a() {
var x = 1;
function b() {
var y = 2;
}
}
I thought that the prev scope to b's scope should be a's scope.
But the previous scope to the function b's scope is a block scope which has props only b(i.e the b function) whereas it should be the function a's scope which should have props both x and b. See the below image.
I went through the infer.js code and found that this line is causing this. I think that function declaration should not be considered as a block scoped declaration.