@@ -186,7 +186,13 @@ module API {
186
186
/**
187
187
* Gets the data-flow node that gives rise to this node, if any.
188
188
*/
189
- DataFlow:: Node getInducingNode ( ) { this = Impl:: MkUse ( result ) }
189
+ DataFlow:: Node getInducingNode ( ) {
190
+ this = Impl:: MkUse ( result )
191
+ or
192
+ this = Impl:: MkDef ( result )
193
+ or
194
+ this = Impl:: MkMethodCall ( result )
195
+ }
190
196
191
197
/** Gets the location of this node. */
192
198
Location getLocation ( ) {
@@ -233,15 +239,26 @@ module API {
233
239
override string toString ( ) { result = "root" }
234
240
}
235
241
242
+ private string tryGetPath ( Node node ) {
243
+ result = node .getPath ( )
244
+ or
245
+ not exists ( node .getPath ( ) ) and
246
+ result = "with no path"
247
+ }
248
+
236
249
/** A node corresponding to the use of an API component. */
237
250
class Use extends Node , Impl:: MkUse {
238
- override string toString ( ) {
239
- exists ( string type | type = "Use " |
240
- result = type + this .getPath ( )
241
- or
242
- not exists ( this .getPath ( ) ) and result = type + "with no path"
243
- )
244
- }
251
+ override string toString ( ) { result = "Use " + tryGetPath ( this ) }
252
+ }
253
+
254
+ /** A node corresponding to a value escaping into an API component. */
255
+ class Def extends Node , Impl:: MkDef {
256
+ override string toString ( ) { result = "Def " + tryGetPath ( this ) }
257
+ }
258
+
259
+ /** A node corresponding to a method call. */
260
+ class MethodCall extends Node , Impl:: MkMethodCall {
261
+ override string toString ( ) { result = "MethodCall " + tryGetPath ( this ) }
245
262
}
246
263
247
264
/** Gets the root node. */
@@ -443,7 +460,9 @@ module API {
443
460
* Holds if there should be a `lbl`-edge from the given call to an argument.
444
461
*/
445
462
pragma [ nomagic]
446
- private predicate argumentStep ( string lbl , DataFlow:: CallNode call , DataFlowPrivate:: ArgumentNode argument ) {
463
+ private predicate argumentStep (
464
+ string lbl , DataFlow:: CallNode call , DataFlowPrivate:: ArgumentNode argument
465
+ ) {
447
466
exists ( DataFlowDispatch:: ArgumentPosition argPos |
448
467
argument .sourceArgumentOf ( call .asExpr ( ) , argPos ) and
449
468
lbl = getLabelFromArgumentPosition ( argPos )
@@ -454,7 +473,9 @@ module API {
454
473
* Holds if there should be a `lbl`-edge from the given callable to a parameter.
455
474
*/
456
475
pragma [ nomagic]
457
- private predicate parameterStep ( string lbl , DataFlow:: Node callable , DataFlowPrivate:: ParameterNodeImpl paramNode ) {
476
+ private predicate parameterStep (
477
+ string lbl , DataFlow:: Node callable , DataFlowPrivate:: ParameterNodeImpl paramNode
478
+ ) {
458
479
exists ( DataFlowDispatch:: ParameterPosition paramPos |
459
480
paramNode .isSourceParameterOf ( callable .asExpr ( ) .getExpr ( ) , paramPos ) and
460
481
lbl = getLabelFromParameterPosition ( paramPos )
0 commit comments