mirror of
https://github.com/github/codeql.git
synced 2026-02-08 11:11:06 +01:00
Add AST node for expression annotations
This commit is contained in:
@@ -857,6 +857,20 @@ class Expr extends TExpr, AstNode {
|
||||
}
|
||||
}
|
||||
|
||||
class ExprAnnotation extends TExprAnnotation, Expr {
|
||||
Generated::ExprAnnotation expr_anno;
|
||||
|
||||
ExprAnnotation() { this = TExprAnnotation(expr_anno) }
|
||||
|
||||
string getName() { result = expr_anno.getName().getValue() }
|
||||
|
||||
string getAnnotationArgument() { result = expr_anno.getAnnotArg().getValue() }
|
||||
|
||||
Expr getExpression() { toGenerated(result) = expr_anno.getChild() }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "ExprAnnotation" }
|
||||
}
|
||||
|
||||
/** A function symbol, such as `+` or `*`. */
|
||||
class FunctionSymbol extends string {
|
||||
FunctionSymbol() { this = "+" or this = "-" or this = "*" or this = "/" or this = "%" }
|
||||
|
||||
@@ -40,6 +40,7 @@ newtype TAstNode =
|
||||
TIfFormula(Generated::IfTerm ifterm) or
|
||||
TImplication(Generated::Implication impl) or
|
||||
TInstanceOf(Generated::InstanceOf inst) or
|
||||
TExprAnnotation(Generated::ExprAnnotation expr_anno) or
|
||||
TAddExpr(Generated::AddExpr addexp) or
|
||||
TLiteral(Generated::Literal lit) or
|
||||
TUnaryExpr(Generated::UnaryExpr unaryexpr) or
|
||||
@@ -55,7 +56,7 @@ class TBinOpExpr = TAddExpr;
|
||||
|
||||
class TExpr =
|
||||
TBinOpExpr or TLiteral or TAggregate or TIdentifier or TInlineCast or TCall or TUnaryExpr or
|
||||
TDontCare;
|
||||
TExprAnnotation or TDontCare;
|
||||
|
||||
class TCall = TPredicateCall or TMemberCall or TNoneCall or TAnyCall;
|
||||
|
||||
@@ -77,6 +78,7 @@ Generated::AstNode toGeneratedFormula(AST::AstNode n) {
|
||||
|
||||
Generated::AstNode toGeneratedExpr(AST::AstNode n) {
|
||||
n = TAddExpr(result) or
|
||||
n = TExprAnnotation(result) or
|
||||
n = TLiteral(result) or
|
||||
n = TAggregate(result) or
|
||||
n = TIdentifier(result) or
|
||||
|
||||
Reference in New Issue
Block a user