From be495b28dadabb1ba17b3f21fdca7a0dfbda7989 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Thu, 27 May 2021 10:12:03 +0000 Subject: [PATCH] add cases to the getParent relation --- ql/src/codeql_ql/ast/Ast.qll | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ql/src/codeql_ql/ast/Ast.qll b/ql/src/codeql_ql/ast/Ast.qll index c8c5c321ec4..a4657f539da 100644 --- a/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/src/codeql_ql/ast/Ast.qll @@ -176,6 +176,12 @@ class Type extends TType, AstNode { * E.g. `DataFlow` in `DataFlow::Node`. */ ModuleExpr getModule() { toGenerated(result) = type.getChild() } + + override AstNode getParent() { + result = super.getParent() + or + result.(InlineCast).getType() = this + } } /** @@ -707,7 +713,15 @@ class Negation extends TNegation, Formula { } /** An expression, such as `x+4`. */ -class Expr extends TExpr, AstNode { } +class Expr extends TExpr, AstNode { + override AstNode getParent() { + result = super.getParent() + or + result.(Call).getArgument(_) = this + or + result.(Aggregate).getOrderBy(_) = this + } +} /** A function symbol, such as `+` or `*`. */ class FunctionSymbol extends string {