You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Named function expressions create an extra scope object which only contain the function name binding. It should have a child scope which contains all of the bindings in the function body and parameter list.
To be honest such behaviour doesn't makes much sense from my point of view, but if this is what actually happening when it runs then ok. However, why does 'acquire' points to this particular scope? It's rather inconvenient and inconsistent in combination with traverse. It makes more sense to point to actual function's scope. That one would remain available through .upper anyway in case anyone ever needs it.
I disagree. The nearest scope object to the function expression's AST node is the one containing the function name. I would be okay with associating the inner scope object with the FunctionBody node, if that's not how it's already done today.
Here is an example code:
Expected result:
undefined 'a' true
a b true
undefined 'c' true
undefined 'd' true
x z true
Actual result (notice second and third rows):
undefined 'a' true
a b false
!!!subscope: true
undefined 'c' true
undefined 'd' true
x z true
Why is it like that?
Also, the only variable available in the scope of function 'a' is 'a' which points to function itself.
The text was updated successfully, but these errors were encountered: