Skip to content

Commit 4570d7e

Browse files
committed
Rust: Replace getBlockChildNode with uses of getStmtOrExpr.
1 parent 27b6f12 commit 4570d7e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,23 +266,16 @@ module ExprTrees {
266266
}
267267
}
268268

269-
private AstNode getBlockChildNode(BlockExpr b, int i) {
270-
result = b.getStmtList().getStatement(i)
271-
or
272-
i = b.getStmtList().getNumberOfStatements() and
273-
result = b.getStmtList().getTailExpr()
274-
}
275-
276269
class AsyncBlockExprTree extends StandardTree, PreOrderTree, PostOrderTree, AsyncBlockExpr {
277-
override AstNode getChildNode(int i) { result = getBlockChildNode(this, i) }
270+
override AstNode getChildNode(int i) { result = this.getStmtList().getStmtOrExpr(i) }
278271

279272
override predicate propagatesAbnormal(AstNode child) { none() }
280273
}
281274

282275
class BlockExprTree extends StandardPostOrderTree, BlockExpr {
283276
BlockExprTree() { not this.isAsync() }
284277

285-
override AstNode getChildNode(int i) { result = getBlockChildNode(this, i) }
278+
override AstNode getChildNode(int i) { result = this.getStmtList().getStmtOrExpr(i) }
286279

287280
override predicate propagatesAbnormal(AstNode child) { child = this.getChildNode(_) }
288281
}

0 commit comments

Comments
 (0)