@@ -20,31 +20,9 @@ private newtype TOptionalTypeTrackerContent =
20
20
MkContent ( DataFlowPublic:: Content content ) or
21
21
MkNoContent ( )
22
22
23
- /** A content for use by type trackers, or the empty content `noContent()` */
24
- class OptionalTypeTrackerContent extends TOptionalTypeTrackerContent {
25
- /** Gets a textual representation of this content. */
26
- string toString ( ) {
27
- result = "attribute " + this .asAttributeName ( )
28
- or
29
- result = this .asContent ( ) .toString ( )
30
- or
31
- this instanceof MkNoContent and result = "no content"
32
- }
33
-
34
- /** Gets the attribute name represented by this content, if any. */
35
- string asAttributeName ( ) { this = MkAttribute ( result ) }
36
-
37
- /** Gets the data flow content by this type-tracker content, if any. */
38
- DataFlowPublic:: Content asContent ( ) { this = MkContent ( result ) }
39
- }
40
-
41
- /** Gets the value representing no content, that is, the empty access path. */
42
- OptionalTypeTrackerContent noContent ( ) { result = MkNoContent ( ) }
43
-
44
- private class TTypeTrackerContent = MkAttribute or MkContent ;
23
+ class TypeTrackerContent = DataFlowPublic:: Content ;
45
24
46
- /** A content for use by type trackers. */
47
- class TypeTrackerContent extends OptionalTypeTrackerContent , TTypeTrackerContent { }
25
+ predicate noContent = DataFlowPublic:: Content:: noContent / 0 ;
48
26
49
27
/** Holds if there is a simple local flow step from `nodeFrom` to `nodeTo` */
50
28
predicate simpleLocalFlowStep = DataFlowPrivate:: localFlowStepTypeTracker / 2 ;
@@ -185,7 +163,7 @@ predicate basicStoreStep(Node nodeFrom, Node nodeTo, TypeTrackerContent content)
185
163
SummaryComponentStack:: singleton ( output ) ) ) and
186
164
nodeFrom = evaluateSummaryComponentLocal ( call , input ) and
187
165
nodeTo = evaluateSummaryComponentLocal ( call , output ) and
188
- content . asContent ( ) = contents .getAStoreContent ( )
166
+ content = contents .getAStoreContent ( )
189
167
)
190
168
}
191
169
@@ -196,7 +174,10 @@ predicate basicStoreStep(Node nodeFrom, Node nodeTo, TypeTrackerContent content)
196
174
predicate postUpdateStoreStep ( Node nodeFrom , Node nodeTo , TypeTrackerContent content ) {
197
175
// TODO: support SetterMethodCall inside TuplePattern
198
176
exists ( ExprNodes:: MethodCallCfgNode call |
199
- content = MkAttribute ( call .getExpr ( ) .( Ast:: SetterMethodCall ) .getTargetName ( ) ) and
177
+ content =
178
+ DataFlowPublic:: Content:: getAttributeName ( call .getExpr ( )
179
+ .( Ast:: SetterMethodCall )
180
+ .getTargetName ( ) ) and
200
181
nodeTo .( DataFlowPublic:: PostUpdateNode ) .getPreUpdateNode ( ) .asExpr ( ) = call .getReceiver ( ) and
201
182
call .getExpr ( ) instanceof Ast:: SetterMethodCall and
202
183
call .getArgument ( call .getNumberOfArguments ( ) - 1 ) =
@@ -210,7 +191,7 @@ predicate postUpdateStoreStep(Node nodeFrom, Node nodeTo, TypeTrackerContent con
210
191
predicate basicLoadStep ( Node nodeFrom , Node nodeTo , TypeTrackerContent content ) {
211
192
exists ( ExprNodes:: MethodCallCfgNode call |
212
193
call .getExpr ( ) .getNumberOfArguments ( ) = 0 and
213
- content = MkAttribute ( call .getExpr ( ) .getMethodName ( ) ) and
194
+ content = DataFlowPublic :: Content :: getAttributeName ( call .getExpr ( ) .getMethodName ( ) ) and
214
195
nodeFrom .asExpr ( ) = call .getReceiver ( ) and
215
196
nodeTo .asExpr ( ) = call
216
197
)
@@ -225,7 +206,7 @@ predicate basicLoadStep(Node nodeFrom, Node nodeTo, TypeTrackerContent content)
225
206
SummaryComponentStack:: singleton ( output ) ) and
226
207
nodeFrom = evaluateSummaryComponentLocal ( call , input ) and
227
208
nodeTo = evaluateSummaryComponentLocal ( call , output ) and
228
- content . asContent ( ) = contents .getAReadContent ( )
209
+ content = contents .getAReadContent ( )
229
210
)
230
211
}
231
212
0 commit comments