Skip to content

Commit aab0d5e

Browse files
committed
Rust: Refactor to avoid needing getNumberOfSelfParams
1 parent 24adbb8 commit aab0d5e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,13 @@ import CfgImpl
7272
class CallableScopeTree extends StandardTree, PreOrderTree, PostOrderTree, Scope::CallableScope {
7373
override predicate propagatesAbnormal(AstNode child) { none() }
7474

75-
private int getNumberOfSelfParams() {
76-
if this.getParamList().hasSelfParam() then result = 1 else result = 0
77-
}
78-
7975
override AstNode getChildNode(int i) {
8076
i = 0 and
8177
result = this.getParamList().getSelfParam()
8278
or
83-
result = this.getParamList().getParam(i - this.getNumberOfSelfParams())
79+
result = this.getParamList().getParam(i - 1)
8480
or
85-
i = this.getParamList().getNumberOfParams() + this.getNumberOfSelfParams() and
81+
i = this.getParamList().getNumberOfParams() + 1 and
8682
result = this.getBody()
8783
}
8884
}

0 commit comments

Comments
 (0)