Skip to content

Commit 2818893

Browse files
paldepindhvitved
andauthored
Rust: Refactor AstCfgNode to use a field
Co-authored-by: Tom Hvitved <[email protected]>
1 parent 6b25bea commit 2818893

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

rust/ql/lib/codeql/rust/controlflow/CfgNodes.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ private import ControlFlowGraph
88

99
/** A CFG node that corresponds to an element in the AST. */
1010
class AstCfgNode extends CfgNode {
11-
AstCfgNode() { exists(this.getAstNode()) }
11+
AstNode node;
12+
13+
AstCfgNode() { node = this.getAstNode() }
1214
}
1315

1416
/** A CFG node that corresponds to an expression in the AST. */
1517
class ExprCfgNode extends AstCfgNode {
16-
ExprCfgNode() { this.getAstNode() instanceof Expr }
18+
override Expr node;
1719

1820
/** Gets the underlying expression. */
19-
Expr getExpr() { result = this.getAstNode() }
21+
Expr getExpr() { result = node }
2022
}

0 commit comments

Comments
 (0)