mirror of
https://github.com/github/codeql.git
synced 2026-05-04 05:05:12 +02:00
JS: Reset implicit variable scope when leaving template expr
This commit is contained in:
@@ -732,7 +732,10 @@ public class ASTExtractor {
|
||||
visitAll(nd.getBody(), toplevelLabel);
|
||||
|
||||
// Leave the local scope again.
|
||||
if (sourceType.hasLocalScope()) scopeManager.leaveScope();
|
||||
if (sourceType.hasLocalScope()) {
|
||||
scopeManager.leaveScope();
|
||||
scopeManager.resetImplicitVariableScope();
|
||||
}
|
||||
|
||||
contextManager.leaveContainer();
|
||||
|
||||
|
||||
@@ -119,6 +119,14 @@ public class ScopeManager {
|
||||
this.implicitVariableScope = implicitVariableScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the scope in which to declare variables that are referenced without
|
||||
* being declared back to the global scope.
|
||||
*/
|
||||
public void resetImplicitVariableScope() {
|
||||
this.implicitVariableScope = toplevelScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter a new scope.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user