Skip to content

Commit 45ae088

Browse files
authored
QL: Make getParameter 0-indexed
1 parent 236f413 commit 45ae088

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

ql/src/codeql_ql/ast/Ast.qll

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,11 @@ class ClasslessPredicate extends TClasslessPredicate, Predicate, ModuleDeclarati
199199

200200
override VarDecl getParameter(int i) {
201201
toGenerated(result) =
202-
rank[i](Generated::VarDecl decl, int index | decl = pred.getChild(index) | decl order by index)
202+
rank[i + 1](Generated::VarDecl decl, int index |
203+
decl = pred.getChild(index)
204+
|
205+
decl order by index
206+
)
203207
}
204208

205209
override TypeExpr getReturnTypeExpr() { toGenerated(result) = pred.getReturnType() }
@@ -244,7 +248,11 @@ class ClassPredicate extends TClassPredicate, Predicate {
244248

245249
override VarDecl getParameter(int i) {
246250
toGenerated(result) =
247-
rank[i](Generated::VarDecl decl, int index | decl = pred.getChild(index) | decl order by index)
251+
rank[i + 1](Generated::VarDecl decl, int index |
252+
decl = pred.getChild(index)
253+
|
254+
decl order by index
255+
)
248256
}
249257

250258
ClassType getDeclaringType() { result.getDeclaration() = getParent() }

0 commit comments

Comments
 (0)