Skip to content

Commit cb3da0e

Browse files
authored
Swift: add some ParamDecl methods
1 parent 776a296 commit cb3da0e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed
Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
21
private import codeql.swift.generated.decl.ParamDecl
2+
private import codeql.swift.elements.decl.AbstractFunctionDecl
33

4-
class ParamDecl extends ParamDeclBase { }
4+
class ParamDecl extends ParamDeclBase {
5+
/** Gets the function which declares this parameter. */
6+
AbstractFunctionDecl getDeclaringFunction() {
7+
result.getAParam() = this
8+
}
9+
10+
/** Gets the index of this parameter in its declaring function's parameter list. */
11+
int getIndex() {
12+
exists(AbstractFunctionDecl func |
13+
func.getParam(result) = this
14+
)
15+
}
16+
}

0 commit comments

Comments
 (0)