Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ public Label visit(Program nd, Context c) {
// add all declared global (or module-scoped) names, both non-lexical and lexical
scopeManager.addNames(scopeManager.collectDeclaredNames(nd, isStrict, false, DeclKind.none));
scopeManager.addNames(scopeManager.collectDeclaredNames(nd, isStrict, true, DeclKind.none));
scopeManager.addVariables("this");

visitAll(nd.getBody(), toplevelLabel);

Expand Down Expand Up @@ -1070,6 +1071,9 @@ private void extractFunction(IFunction nd, Label key) {

scopeManager.enterScope((Node) nd);
scopeManager.addNames(locals);
if (!(nd instanceof ArrowFunctionExpression)) {
scopeManager.addVariables("this");
}

// The name of a function expression binds to its own scope.
if (nd.getId() != null && nd instanceof AFunctionExpression) {
Expand Down