Add local flow step for parenthesized expressions

This commit is contained in:
Arthur Baars
2021-02-04 13:49:55 +01:00
parent f8cca01e6f
commit a998879897
2 changed files with 8 additions and 0 deletions

View File

@@ -249,6 +249,11 @@ module ExprNodes {
final ExprCfgNode getExpr(int n) { e.hasCfgChild(e.getExpr(n), this, result) }
}
/** A control-flow node that wraps an `ExprSequence` AST expression. */
class ParenthesizedExprCfgNode extends ExprSequenceCfgNode {
ParenthesizedExprCfgNode() { this.getExpr() instanceof ParenthesizedExpr }
}
/** A control-flow node that wraps a `VariableReadAccess` AST expression. */
class VariableReadAccessCfgNode extends ExprCfgNode {
override VariableReadAccess e;

View File

@@ -124,6 +124,9 @@ private module Cached {
exists(Ssa::Definition def | LocalFlow::localSsaFlowStep(def, nodeFrom, nodeTo))
or
nodeFrom.asExpr() = nodeTo.asExpr().(CfgNodes::ExprNodes::AssignExprCfgNode).getRhs()
or
nodeFrom.asExpr() =
nodeTo.asExpr().(CfgNodes::ExprNodes::ParenthesizedExprCfgNode).getLastExpr()
}
cached