add super nodes

This commit is contained in:
Erik Krogh Kristensen
2021-05-29 08:27:00 +00:00
committed by GitHub
parent 5dcc161f2d
commit 2d86b13d44
2 changed files with 11 additions and 1 deletions

View File

@@ -1523,6 +1523,13 @@ class ThisAccess extends Identifier {
override string getAPrimaryQlClass() { result = "ThisAccess" }
}
/** A use of `super`. */
class Super extends TSuper, Expr {
Super() { this = TSuper(_) }
override string getAPrimaryQlClass() { result = "SuperAccess" }
}
/** An access to `result`. */
class ResultAccess extends Identifier {
ResultAccess() { any(Generated::Result r).getParent() = id }

View File

@@ -24,6 +24,7 @@ newtype TAstNode =
TExprAggregate(Generated::Aggregate agg) {
agg.getChild(_) instanceof Generated::ExprAggregateBody
} or
TSuper(Generated::SuperRef sup) or
TIdentifier(Generated::Variable var) or
TAsExpr(Generated::AsExpr asExpr) { asExpr.getChild(1) instanceof Generated::VarName } or
TPredicateCall(Generated::CallOrUnqualAggExpr call) or
@@ -63,7 +64,7 @@ class TBinOpExpr = TAddSubExpr or TMulDivModExpr;
class TExpr =
TBinOpExpr or TLiteral or TAggregate or TExprAggregate or TIdentifier or TInlineCast or TCall or
TUnaryExpr or TExprAnnotation or TDontCare or TRange or TSet or TAsExpr;
TUnaryExpr or TExprAnnotation or TDontCare or TRange or TSet or TAsExpr or TSuper;
class TCall = TPredicateCall or TMemberCall or TNoneCall or TAnyCall;
@@ -154,6 +155,8 @@ Generated::AstNode toGenerated(AST::AstNode n) {
n = TNoneCall(result)
or
n = TAnyCall(result)
or
n = TSuper(result)
}
class TPredicate = TCharPred or TClasslessPredicate or TClassPredicate;