-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathParamModules.qll
More file actions
63 lines (43 loc) · 1.11 KB
/
ParamModules.qll
File metadata and controls
63 lines (43 loc) · 1.11 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module PredicateSig {
signature predicate fooSig(int i);
module UsesFoo<fooSig/1 fooImpl> {
predicate bar(int i) { fooImpl(i + 1) }
}
predicate myFoo(int i) { i = 42 }
predicate use(int i) { UsesFoo<myFoo/1>::bar(i) }
}
module ClassSig {
signature class FooSig extends int;
module UsesFoo<FooSig FooImpl> {
FooImpl getAnEven() { result % 2 = 0 }
}
class MyFoo extends int {
MyFoo() { this = [0 .. 10] }
string myFoo() { result = "myFoo" }
}
string use() { result = UsesFoo<MyFoo>::getAnEven().myFoo() }
}
module ModuleSig {
signature module FooSig {
class A;
A getThing();
}
module UsesFoo<FooSig FooImpl> {
B getThing() { result = FooImpl::getThing() }
class B = FooImpl::A;
}
module MyFoo implements FooSig {
class C extends int {
C() { this = [0 .. 10] }
string myFoo() { result = "myFoo" }
}
class A = C;
C getThing() { any() }
}
module ImplStuff {
module Inst = UsesFoo<MyFoo>;
class D = Inst::B;
string use1() { result = Inst::getThing().myFoo() }
string use2(Inst::B b) { result = b.myFoo() }
}
}