@@ -14,14 +14,14 @@ newtype TNode =
1414 not e .getParent * ( ) instanceof Annotation
1515 } or
1616 TExplicitParameterNode ( Parameter p ) {
17- exists ( p .getCallable ( ) .getBody ( ) ) or p .getCallable ( ) instanceof SummarizedCallable
17+ exists ( p .getCallable ( ) .getBody ( ) ) or p .getCallable ( ) = any ( SummarizedCallable sc ) . asCallable ( )
1818 } or
1919 TImplicitVarargsArray ( Call c ) {
2020 c .getCallee ( ) .isVarargs ( ) and
2121 not exists ( Argument arg | arg .getCall ( ) = c and arg .isExplicitVarargsArray ( ) )
2222 } or
2323 TInstanceParameterNode ( Callable c ) {
24- ( exists ( c .getBody ( ) ) or c instanceof SummarizedCallable ) and
24+ ( exists ( c .getBody ( ) ) or c = any ( SummarizedCallable sc ) . asCallable ( ) ) and
2525 not c .isStatic ( )
2626 } or
2727 TImplicitInstanceAccess ( InstanceAccessExt ia ) { not ia .isExplicit ( _) } or
@@ -44,7 +44,8 @@ newtype TNode =
4444 } or
4545 TSummaryInternalNode ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNodeState state ) {
4646 FlowSummaryImpl:: Private:: summaryNodeRange ( c , state )
47- }
47+ } or
48+ TFieldValueNode ( Field f )
4849
4950private predicate explicitInstanceArgument ( Call call , Expr instarg ) {
5051 call instanceof MethodAccess and
@@ -94,19 +95,12 @@ module Public {
9495 result = this .( MallocNode ) .getClassInstanceExpr ( ) .getType ( )
9596 or
9697 result = this .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) .getType ( )
98+ or
99+ result = this .( FieldValueNode ) .getField ( ) .getType ( )
97100 }
98101
99102 /** Gets the callable in which this node occurs. */
100- Callable getEnclosingCallable ( ) {
101- result = this .asExpr ( ) .getEnclosingCallable ( ) or
102- result = this .asParameter ( ) .getCallable ( ) or
103- result = this .( ImplicitVarargsArray ) .getCall ( ) .getEnclosingCallable ( ) or
104- result = this .( InstanceParameterNode ) .getCallable ( ) or
105- result = this .( ImplicitInstanceAccess ) .getInstanceAccess ( ) .getEnclosingCallable ( ) or
106- result = this .( MallocNode ) .getClassInstanceExpr ( ) .getEnclosingCallable ( ) or
107- result = this .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) .getEnclosingCallable ( ) or
108- this = TSummaryInternalNode ( result , _)
109- }
103+ Callable getEnclosingCallable ( ) { result = nodeGetEnclosingCallable ( this ) .asCallable ( ) }
110104
111105 private Type getImprovedTypeBound ( ) {
112106 exprTypeFlow ( this .asExpr ( ) , result , _) or
@@ -257,6 +251,18 @@ module Public {
257251 abstract Node getPreUpdateNode ( ) ;
258252 }
259253
254+ /**
255+ * A node representing the value of a field.
256+ */
257+ class FieldValueNode extends Node , TFieldValueNode {
258+ /** Gets the field corresponding to this node. */
259+ Field getField ( ) { this = TFieldValueNode ( result ) }
260+
261+ override string toString ( ) { result = getField ( ) .toString ( ) }
262+
263+ override Location getLocation ( ) { result = getField ( ) .getLocation ( ) }
264+ }
265+
260266 /**
261267 * Gets the node that occurs as the qualifier of `fa`.
262268 */
@@ -305,11 +311,21 @@ private class ImplicitExprPostUpdate extends ImplicitPostUpdateNode, TImplicitEx
305311
306312module Private {
307313 /** Gets the callable in which this node occurs. */
308- DataFlowCallable nodeGetEnclosingCallable ( Node n ) { result = n .getEnclosingCallable ( ) }
314+ DataFlowCallable nodeGetEnclosingCallable ( Node n ) {
315+ result .asCallable ( ) = n .asExpr ( ) .getEnclosingCallable ( ) or
316+ result .asCallable ( ) = n .asParameter ( ) .getCallable ( ) or
317+ result .asCallable ( ) = n .( ImplicitVarargsArray ) .getCall ( ) .getEnclosingCallable ( ) or
318+ result .asCallable ( ) = n .( InstanceParameterNode ) .getCallable ( ) or
319+ result .asCallable ( ) = n .( ImplicitInstanceAccess ) .getInstanceAccess ( ) .getEnclosingCallable ( ) or
320+ result .asCallable ( ) = n .( MallocNode ) .getClassInstanceExpr ( ) .getEnclosingCallable ( ) or
321+ result = nodeGetEnclosingCallable ( n .( ImplicitPostUpdateNode ) .getPreUpdateNode ( ) ) or
322+ n = TSummaryInternalNode ( result , _) or
323+ result .asFieldScope ( ) = n .( FieldValueNode ) .getField ( )
324+ }
309325
310326 /** Holds if `p` is a `ParameterNode` of `c` with position `pos`. */
311327 predicate isParameterNode ( ParameterNode p , DataFlowCallable c , int pos ) {
312- p .isParameterOf ( c , pos )
328+ p .isParameterOf ( c . asCallable ( ) , pos )
313329 }
314330
315331 /**
0 commit comments