@@ -13,17 +13,12 @@ newtype TNode =
13
13
not e .getType ( ) instanceof VoidType and
14
14
not e .getParent * ( ) instanceof Annotation
15
15
} or
16
- TExplicitParameterNode ( Parameter p ) {
17
- exists ( p .getCallable ( ) .getBody ( ) ) or p .getCallable ( ) instanceof SummarizedCallable
18
- } or
16
+ TExplicitParameterNode ( Parameter p ) { exists ( p .getCallable ( ) .getBody ( ) ) } or
19
17
TImplicitVarargsArray ( Call c ) {
20
18
c .getCallee ( ) .isVarargs ( ) and
21
19
not exists ( Argument arg | arg .getCall ( ) = c and arg .isExplicitVarargsArray ( ) )
22
20
} or
23
- TInstanceParameterNode ( Callable c ) {
24
- ( exists ( c .getBody ( ) ) or c instanceof SummarizedCallable ) and
25
- not c .isStatic ( )
26
- } or
21
+ TInstanceParameterNode ( Callable c ) { exists ( c .getBody ( ) ) and not c .isStatic ( ) } or
27
22
TImplicitInstanceAccess ( InstanceAccessExt ia ) { not ia .isExplicit ( _) } or
28
23
TMallocNode ( ClassInstanceExpr cie ) or
29
24
TExplicitExprPostUpdate ( Expr e ) {
@@ -45,6 +40,9 @@ newtype TNode =
45
40
TSummaryInternalNode ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
46
41
FlowSummaryImpl:: Private:: summaryNodeRange ( c , state )
47
42
} or
43
+ TSummaryParameterNode ( SummarizedCallable c , int pos ) {
44
+ FlowSummaryImpl:: Private:: summaryParameterNodeRange ( c , pos )
45
+ } or
48
46
TFieldValueNode ( Field f )
49
47
50
48
private predicate explicitInstanceArgument ( Call call , Expr instarg ) {
@@ -96,6 +94,8 @@ module Public {
96
94
or
97
95
result = this .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) .getType ( )
98
96
or
97
+ result = this .( SummaryParameterNode ) .getTypeImpl ( )
98
+ or
99
99
result = this .( FieldValueNode ) .getField ( ) .getType ( )
100
100
}
101
101
@@ -155,7 +155,7 @@ module Public {
155
155
* Holds if this node is the parameter of `c` at the specified (zero-based)
156
156
* position. The implicit `this` parameter is considered to have index `-1`.
157
157
*/
158
- abstract predicate isParameterOf ( Callable c , int pos ) ;
158
+ abstract predicate isParameterOf ( DataFlowCallable c , int pos ) ;
159
159
}
160
160
161
161
/**
@@ -173,7 +173,9 @@ module Public {
173
173
/** Gets the parameter corresponding to this node. */
174
174
Parameter getParameter ( ) { result = param }
175
175
176
- override predicate isParameterOf ( Callable c , int pos ) { c .getParameter ( pos ) = param }
176
+ override predicate isParameterOf ( DataFlowCallable c , int pos ) {
177
+ c .asCallable ( ) .getParameter ( pos ) = param
178
+ }
177
179
}
178
180
179
181
/** Gets the node corresponding to `p`. */
@@ -213,7 +215,9 @@ module Public {
213
215
/** Gets the callable containing this `this` parameter. */
214
216
Callable getCallable ( ) { result = callable }
215
217
216
- override predicate isParameterOf ( Callable c , int pos ) { callable = c and pos = - 1 }
218
+ override predicate isParameterOf ( DataFlowCallable c , int pos ) {
219
+ callable = c .asCallable ( ) and pos = - 1
220
+ }
217
221
}
218
222
219
223
/**
@@ -336,13 +340,14 @@ module Private {
336
340
result .asCallable ( ) = n .( ImplicitInstanceAccess ) .getInstanceAccess ( ) .getEnclosingCallable ( ) or
337
341
result .asCallable ( ) = n .( MallocNode ) .getClassInstanceExpr ( ) .getEnclosingCallable ( ) or
338
342
result = nodeGetEnclosingCallable ( n .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) ) or
339
- n = TSummaryInternalNode ( result .asCallable ( ) , _) or
343
+ n = TSummaryInternalNode ( result .asSummarizedCallable ( ) , _) or
344
+ n = TSummaryParameterNode ( result .asSummarizedCallable ( ) , _) or
340
345
result .asFieldScope ( ) = n .( FieldValueNode ) .getField ( )
341
346
}
342
347
343
348
/** Holds if `p` is a `ParameterNode` of `c` with position `pos`. */
344
349
predicate isParameterNode ( ParameterNode p , DataFlowCallable c , ParameterPosition pos ) {
345
- p .isParameterOf ( c . asCallable ( ) , pos )
350
+ p .isParameterOf ( c , pos )
346
351
}
347
352
348
353
/** Holds if `arg` is an `ArgumentNode` of `c` with position `pos`. */
@@ -443,6 +448,27 @@ module Private {
443
448
SummaryNode getSummaryNode ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
444
449
result = TSummaryInternalNode ( c , state )
445
450
}
451
+
452
+ class SummaryParameterNode extends ParameterNode , TSummaryParameterNode {
453
+ private SummarizedCallable sc ;
454
+ private int pos_ ;
455
+
456
+ SummaryParameterNode ( ) { this = TSummaryParameterNode ( sc , pos_ ) }
457
+
458
+ override Location getLocation ( ) { result = sc .getLocation ( ) }
459
+
460
+ override string toString ( ) { result = "[summary param] " + pos_ + " in " + sc }
461
+
462
+ override predicate isParameterOf ( DataFlowCallable c , int pos ) {
463
+ c .asSummarizedCallable ( ) = sc and pos = pos_
464
+ }
465
+
466
+ Type getTypeImpl ( ) {
467
+ result = sc .getParameter ( pos_ ) .getType ( )
468
+ or
469
+ pos_ = - 1 and result = sc .getDeclaringType ( )
470
+ }
471
+ }
446
472
}
447
473
448
474
private import Private
0 commit comments