@@ -12,30 +12,36 @@ private module Cached {
12
12
LevelStep ( ) or
13
13
CallStep ( ) or
14
14
ReturnStep ( ) or
15
- StoreStep ( TypeTrackerContent content ) or
16
- LoadStep ( TypeTrackerContent content ) or
15
+ StoreStep ( TypeTrackerContentSet contents ) or
16
+ LoadStep ( TypeTrackerContentSet contents ) or
17
17
JumpStep ( )
18
18
19
19
/** Gets the summary resulting from appending `step` to type-tracking summary `tt`. */
20
20
cached
21
21
TypeTracker append ( TypeTracker tt , StepSummary step ) {
22
- exists ( Boolean hasCall , OptionalTypeTrackerContent content |
23
- tt = MkTypeTracker ( hasCall , content )
22
+ exists ( Boolean hasCall , OptionalTypeTrackerContent currentContent |
23
+ tt = MkTypeTracker ( hasCall , currentContent )
24
24
|
25
25
step = LevelStep ( ) and result = tt
26
26
or
27
- step = CallStep ( ) and result = MkTypeTracker ( true , content )
27
+ step = CallStep ( ) and result = MkTypeTracker ( true , currentContent )
28
28
or
29
29
step = ReturnStep ( ) and hasCall = false and result = tt
30
30
or
31
- step = LoadStep ( content ) and result = MkTypeTracker ( hasCall , noContent ( ) )
31
+ exists ( TypeTrackerContentSet contents |
32
+ step = LoadStep ( contents ) and
33
+ currentContent = contents .getAReadContent ( ) and
34
+ result = MkTypeTracker ( hasCall , noContent ( ) )
35
+ )
32
36
or
33
- exists ( TypeTrackerContent p |
34
- step = StoreStep ( p ) and content = noContent ( ) and result = MkTypeTracker ( hasCall , p )
37
+ exists ( TypeTrackerContentSet contents |
38
+ step = StoreStep ( contents ) and
39
+ currentContent = noContent ( ) and
40
+ result = MkTypeTracker ( hasCall , contents .getAStoreContent ( ) )
35
41
)
36
42
or
37
43
step = JumpStep ( ) and
38
- result = MkTypeTracker ( false , content )
44
+ result = MkTypeTracker ( false , currentContent )
39
45
)
40
46
}
41
47
@@ -51,11 +57,17 @@ private module Cached {
51
57
or
52
58
step = ReturnStep ( ) and result = MkTypeBackTracker ( true , content )
53
59
or
54
- exists ( TypeTrackerContent p |
55
- step = LoadStep ( p ) and content = noContent ( ) and result = MkTypeBackTracker ( hasReturn , p )
60
+ exists ( TypeTrackerContentSet contents |
61
+ step = LoadStep ( contents ) and
62
+ content = noContent ( ) and
63
+ result = MkTypeBackTracker ( hasReturn , contents .getAStoreContent ( ) )
56
64
)
57
65
or
58
- step = StoreStep ( content ) and result = MkTypeBackTracker ( hasReturn , noContent ( ) )
66
+ exists ( TypeTrackerContentSet contents |
67
+ step = StoreStep ( contents ) and
68
+ content = contents .getAReadContent ( ) and
69
+ result = MkTypeBackTracker ( hasReturn , noContent ( ) )
70
+ )
59
71
or
60
72
step = JumpStep ( ) and
61
73
result = MkTypeBackTracker ( false , content )
@@ -99,9 +111,11 @@ class StepSummary extends TStepSummary {
99
111
or
100
112
this instanceof ReturnStep and result = "return"
101
113
or
102
- exists ( TypeTrackerContent content | this = StoreStep ( content ) | result = "store " + content )
114
+ exists ( TypeTrackerContentSet contents | this = StoreStep ( contents ) |
115
+ result = "store " + contents
116
+ )
103
117
or
104
- exists ( TypeTrackerContent content | this = LoadStep ( content ) | result = "load " + content )
118
+ exists ( TypeTrackerContentSet contents | this = LoadStep ( contents ) | result = "load " + contents )
105
119
or
106
120
this instanceof JumpStep and result = "jump"
107
121
}
@@ -115,11 +129,11 @@ private predicate smallstepNoCall(Node nodeFrom, TypeTrackingNode nodeTo, StepSu
115
129
levelStep ( nodeFrom , nodeTo ) and
116
130
summary = LevelStep ( )
117
131
or
118
- exists ( TypeTrackerContent content |
119
- StepSummary:: localSourceStoreStep ( nodeFrom , nodeTo , content ) and
120
- summary = StoreStep ( content )
132
+ exists ( TypeTrackerContentSet contents |
133
+ StepSummary:: localSourceStoreStep ( nodeFrom , nodeTo , contents ) and
134
+ summary = StoreStep ( contents )
121
135
or
122
- basicLoadStep ( nodeFrom , nodeTo , content ) and summary = LoadStep ( content )
136
+ basicLoadStep ( nodeFrom , nodeTo , contents ) and summary = LoadStep ( contents )
123
137
)
124
138
}
125
139
@@ -189,8 +203,10 @@ module StepSummary {
189
203
* function. This means we will track the fact that `x.attr` can have the type of `y` into the
190
204
* assignment to `z` inside `bar`, even though this attribute write happens _after_ `bar` is called.
191
205
*/
192
- predicate localSourceStoreStep ( Node nodeFrom , TypeTrackingNode nodeTo , TypeTrackerContent content ) {
193
- exists ( Node obj | nodeTo .flowsTo ( obj ) and basicStoreStep ( nodeFrom , obj , content ) )
206
+ predicate localSourceStoreStep (
207
+ Node nodeFrom , TypeTrackingNode nodeTo , TypeTrackerContentSet contents
208
+ ) {
209
+ exists ( Node obj | nodeTo .flowsTo ( obj ) and basicStoreStep ( nodeFrom , obj , contents ) )
194
210
}
195
211
}
196
212
0 commit comments