From e683f04e7b1d55d9dadcebfc0d4e94eb5598f388 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Tue, 15 Oct 2024 13:37:03 +0100 Subject: [PATCH] PS: Rename getExpr to getBase on ParenExpr. --- .../lib/semmle/code/powershell/ParenExpression.qll | 2 +- .../code/powershell/controlflow/CfgNodes.qll | 14 ++++++++++++++ .../controlflow/internal/ControlFlowGraphImpl.qll | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/powershell/ql/lib/semmle/code/powershell/ParenExpression.qll b/powershell/ql/lib/semmle/code/powershell/ParenExpression.qll index 2e59e94aa6b..6a71d268130 100644 --- a/powershell/ql/lib/semmle/code/powershell/ParenExpression.qll +++ b/powershell/ql/lib/semmle/code/powershell/ParenExpression.qll @@ -1,7 +1,7 @@ import powershell class ParenExpr extends @paren_expression, Expr { - PipelineBase getExpr() { paren_expression(this, result) } + PipelineBase getBase() { paren_expression(this, result) } override SourceLocation getLocation() { paren_expression_location(this, result) } diff --git a/powershell/ql/lib/semmle/code/powershell/controlflow/CfgNodes.qll b/powershell/ql/lib/semmle/code/powershell/controlflow/CfgNodes.qll index 0a07630d31b..f60389e8aeb 100644 --- a/powershell/ql/lib/semmle/code/powershell/controlflow/CfgNodes.qll +++ b/powershell/ql/lib/semmle/code/powershell/controlflow/CfgNodes.qll @@ -501,6 +501,20 @@ module ExprNodes { TypeConstraint getType() { result = e.getType() } } + + class ParenExprChildMapping extends ExprChildMapping, ParenExpr { + override predicate relevantChild(Ast n) { n = this.getBase() } + } + + class ParenCfgNode extends ExprCfgNode { + override string getAPrimaryQlClass() { result = "ParenExprCfgNode" } + + override ParenExprChildMapping e; + + override ParenExpr getExpr() { result = e } + + final StmtCfgNode getBase() { e.hasCfgChild(e.getBase(), this, result) } + } } module StmtNodes { diff --git a/powershell/ql/lib/semmle/code/powershell/controlflow/internal/ControlFlowGraphImpl.qll b/powershell/ql/lib/semmle/code/powershell/controlflow/internal/ControlFlowGraphImpl.qll index 67102e89988..3899fbe23fa 100644 --- a/powershell/ql/lib/semmle/code/powershell/controlflow/internal/ControlFlowGraphImpl.qll +++ b/powershell/ql/lib/semmle/code/powershell/controlflow/internal/ControlFlowGraphImpl.qll @@ -601,7 +601,7 @@ module Trees { } class ParenExprTree extends StandardPostOrderTree instanceof ParenExpr { - override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() } + override AstNode getChildNode(int i) { i = 0 and result = super.getBase() } } class TypeNameExprTree extends LeafTree instanceof TypeNameExpr { }