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 { }