@@ -13,17 +13,12 @@ newtype TNode =
1313 not e .getType ( ) instanceof VoidType and
1414 not e .getParent * ( ) instanceof Annotation
1515 } 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
1917 TImplicitVarargsArray ( Call c ) {
2018 c .getCallee ( ) .isVarargs ( ) and
2119 not exists ( Argument arg | arg .getCall ( ) = c and arg .isExplicitVarargsArray ( ) )
2220 } 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
2722 TImplicitInstanceAccess ( InstanceAccessExt ia ) { not ia .isExplicit ( _) } or
2823 TMallocNode ( ClassInstanceExpr cie ) or
2924 TExplicitExprPostUpdate ( Expr e ) {
@@ -45,6 +40,9 @@ newtype TNode =
4540 TSummaryInternalNode ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
4641 FlowSummaryImpl:: Private:: summaryNodeRange ( c , state )
4742 } or
43+ TSummaryParameterNode ( SummarizedCallable c , int pos ) {
44+ FlowSummaryImpl:: Private:: summaryParameterNodeRange ( c , pos )
45+ } or
4846 TFieldValueNode ( Field f )
4947
5048private predicate explicitInstanceArgument ( Call call , Expr instarg ) {
@@ -96,6 +94,8 @@ module Public {
9694 or
9795 result = this .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) .getType ( )
9896 or
97+ result = this .( SummaryParameterNode ) .getTypeImpl ( )
98+ or
9999 result = this .( FieldValueNode ) .getField ( ) .getType ( )
100100 }
101101
@@ -155,7 +155,7 @@ module Public {
155155 * Holds if this node is the parameter of `c` at the specified (zero-based)
156156 * position. The implicit `this` parameter is considered to have index `-1`.
157157 */
158- abstract predicate isParameterOf ( Callable c , int pos ) ;
158+ abstract predicate isParameterOf ( DataFlowCallable c , int pos ) ;
159159 }
160160
161161 /**
@@ -173,7 +173,9 @@ module Public {
173173 /** Gets the parameter corresponding to this node. */
174174 Parameter getParameter ( ) { result = param }
175175
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+ }
177179 }
178180
179181 /** Gets the node corresponding to `p`. */
@@ -213,7 +215,9 @@ module Public {
213215 /** Gets the callable containing this `this` parameter. */
214216 Callable getCallable ( ) { result = callable }
215217
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+ }
217221 }
218222
219223 /**
@@ -336,13 +340,14 @@ module Private {
336340 result .asCallable ( ) = n .( ImplicitInstanceAccess ) .getInstanceAccess ( ) .getEnclosingCallable ( ) or
337341 result .asCallable ( ) = n .( MallocNode ) .getClassInstanceExpr ( ) .getEnclosingCallable ( ) or
338342 result = nodeGetEnclosingCallable ( n .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) ) or
339- n = TSummaryInternalNode ( result .asCallable ( ) , _) or
343+ n = TSummaryInternalNode ( result .asSummarizedCallable ( ) , _) or
344+ n = TSummaryParameterNode ( result .asSummarizedCallable ( ) , _) or
340345 result .asFieldScope ( ) = n .( FieldValueNode ) .getField ( )
341346 }
342347
343348 /** Holds if `p` is a `ParameterNode` of `c` with position `pos`. */
344349 predicate isParameterNode ( ParameterNode p , DataFlowCallable c , ParameterPosition pos ) {
345- p .isParameterOf ( c . asCallable ( ) , pos )
350+ p .isParameterOf ( c , pos )
346351 }
347352
348353 /** Holds if `arg` is an `ArgumentNode` of `c` with position `pos`. */
@@ -443,6 +448,27 @@ module Private {
443448 SummaryNode getSummaryNode ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
444449 result = TSummaryInternalNode ( c , state )
445450 }
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+ }
446472}
447473
448474private import Private
0 commit comments