forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunction.ql
More file actions
32 lines (30 loc) · 747 Bytes
/
function.ql
File metadata and controls
32 lines (30 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import swift
string describe(Function f) {
result = "getName:" + f.getName()
or
exists(string a |
f.hasName(a) and
result = "hasName:" + a
)
or
result = "Method" and f instanceof Method
or
exists(string a, string b |
f.(Method).hasQualifiedName(a, b) and
result = "hasQualifiedName(2):" + a + "." + b
)
or
exists(string a, string b, string c |
f.(Method).hasQualifiedName(a, b, c) and
result = "hasQualifiedName(3):" + a + "." + b + "." + c
)
or
exists(Decl td | td.getAMember() = f |
result = "memberOf:" + td.asNominalTypeDecl().getFullName()
)
}
from Function f
where
exists(f.getFile().getRelativePath()) and
not f.getName().matches("%init%")
select f, concat(describe(f), ", ")