Remove VariableScope

This commit is contained in:
Arthur Baars
2021-03-09 11:56:17 +01:00
parent 86a89ab1fe
commit 600d9c66ae
4 changed files with 13 additions and 16 deletions

View File

@@ -12,4 +12,13 @@ class Scope extends AstNode, Scope::ScopeType {
/** Gets the scope in which this scope is nested, if any. */
Scope getOuterScope() { result = range.getOuterScope() }
/** Gets a variable that is declared in this scope. */
final Variable getAVariable() { result.getDeclaringScope() = this }
/** Gets the variable with the given name that is declared in this scope. */
final Variable getVariable(string name) {
result = this.getAVariable() and
result.getName() = name
}
}