Make VariableAccess "abstract"

This commit is contained in:
Arthur Baars
2020-12-18 13:00:28 +01:00
parent b1b2815c26
commit 1ada9feda7
2 changed files with 9 additions and 13 deletions

View File

@@ -60,15 +60,13 @@ class LocalVariable extends Variable {
}
/** An access to a variable. */
class VariableAccess extends Expr, @token_identifier {
class VariableAccess extends Expr {
override VariableAccess::Range range;
/** Gets the variable this identifier refers to. */
Variable getVariable() { result = range.getVariable() }
final override string toString() { result = this.getVariable().getName() }
// TODO uncomment this and fix the params test
//override string getAPrimaryQlClass() { result = "VariableAccess" }
}
/** An access to a local variable. */

View File

@@ -227,20 +227,18 @@ module LocalVariable {
}
module VariableAccess {
class Range extends Expr::Range, @token_identifier {
override Generated::Identifier generated;
Variable variable;
Range() { access(this, variable) }
Variable getVariable() { result = variable }
abstract class Range extends Expr::Range {
abstract Variable getVariable();
}
}
module LocalVariableAccess {
class Range extends VariableAccess::Range {
override LocalVariable variable;
class Range extends VariableAccess::Range, @token_identifier {
override Generated::Identifier generated;
LocalVariable variable;
override LocalVariable getVariable() { result = variable }
Range() { access(this, variable) }
final override LocalVariable getVariable() { result = variable }
}
}