mirror of
https://github.com/github/codeql.git
synced 2026-03-30 20:28:15 +02:00
JS: Emit variables for 'this'
The extractor does not emit bindings for 'this', we just ensure that a variable exists for it
This commit is contained in:
@@ -819,6 +819,7 @@ public class ASTExtractor {
|
||||
// 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);
|
||||
|
||||
@@ -1070,6 +1071,9 @@ public class ASTExtractor {
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user