@@ -44,16 +44,15 @@ signature module ModelGeneratorInputSig<LocationSig Location, InputSig<Location>
4444 * Gets the type of this node.
4545 */
4646 Type getType ( ) ;
47+ }
4748
48- /**
49- * Gets the enclosing callable of this node.
50- */
51- Callable getEnclosingCallable ( ) ;
49+ /** Gets the enclosing callable of `node`. */
50+ Callable getEnclosingCallable ( NodeExtended node ) ;
5251
53- /**
54- * Gets the enclosing callable of this node, when considered as an expression.
55- */
56- Callable getAsExprEnclosingCallable ( ) ;
52+ /**
53+ * Gets the enclosing callable of ` node` , when considered as an expression.
54+ */
55+ Callable getAsExprEnclosingCallable ( NodeExtended node ) ;
5756
5857 /** Gets the parameter corresponding to this node, if any. */
5958 Parameter asParameter ( NodeExtended n ) ;
@@ -462,7 +461,7 @@ module MakeModelGenerator<
462461 predicate isSource ( DataFlow:: Node source , FlowState state ) {
463462 source instanceof DataFlow:: ParameterNode and
464463 exists ( Callable c |
465- c = source . ( NodeExtended ) . getEnclosingCallable ( ) and
464+ c = getEnclosingCallable ( source ) and
466465 c instanceof DataFlowSummaryTargetApi and
467466 not isUninterestingForHeuristicDataFlowModels ( c )
468467 ) and
@@ -472,7 +471,7 @@ module MakeModelGenerator<
472471 predicate isSink ( DataFlow:: Node sink , FlowState state ) {
473472 sink instanceof ReturnNodeExt and
474473 not isOwnInstanceAccessNode ( sink ) and
475- not exists ( captureQualifierFlow ( sink . ( NodeExtended ) . getAsExprEnclosingCallable ( ) ) ) and
474+ not exists ( captureQualifierFlow ( getAsExprEnclosingCallable ( sink ) ) ) and
476475 ( state instanceof TaintRead or state instanceof TaintStore )
477476 }
478477
@@ -516,8 +515,8 @@ module MakeModelGenerator<
516515 DataFlowSummaryTargetApi api , DataFlow:: ParameterNode p , ReturnNodeExt returnNodeExt
517516 ) {
518517 exists ( string input , string output |
519- p . ( NodeExtended ) . getEnclosingCallable ( ) = api and
520- returnNodeExt . getEnclosingCallable ( ) = api and
518+ getEnclosingCallable ( p ) = api and
519+ getEnclosingCallable ( returnNodeExt ) = api and
521520 input = parameterNodeAsInput ( p ) and
522521 output = getOutput ( returnNodeExt ) and
523522 input != output and
@@ -567,11 +566,12 @@ module MakeModelGenerator<
567566 private module PropagateContentFlowConfig implements ContentDataFlow:: ConfigSig {
568567 predicate isSource ( DataFlow:: Node source ) {
569568 source instanceof DataFlow:: ParameterNode and
570- source . ( NodeExtended ) . getEnclosingCallable ( ) instanceof DataFlowSummaryTargetApi
569+ getEnclosingCallable ( source ) instanceof DataFlowSummaryTargetApi
571570 }
572571
573572 predicate isSink ( DataFlow:: Node sink ) {
574- sink .( ReturnNodeExt ) .getEnclosingCallable ( ) instanceof DataFlowSummaryTargetApi
573+ sink instanceof ReturnNodeExt and
574+ getEnclosingCallable ( sink ) instanceof DataFlowSummaryTargetApi
575575 }
576576
577577 predicate isAdditionalFlowStep = isAdditionalContentFlowStep / 2 ;
@@ -664,8 +664,8 @@ module MakeModelGenerator<
664664 PropagateContentFlow:: AccessPath stores , boolean preservesValue
665665 ) {
666666 PropagateContentFlow:: flow ( p , reads , returnNodeExt , stores , preservesValue ) and
667- returnNodeExt . getEnclosingCallable ( ) = api and
668- p . ( NodeExtended ) . getEnclosingCallable ( ) = api
667+ getEnclosingCallable ( returnNodeExt ) = api and
668+ getEnclosingCallable ( p ) = api
669669 }
670670
671671 /**
@@ -709,8 +709,8 @@ module MakeModelGenerator<
709709 PropagateContentFlow:: AccessPath stores , boolean preservesValue
710710 ) {
711711 PropagateContentFlow:: flow ( p , reads , returnNodeExt , stores , preservesValue ) and
712- returnNodeExt . getEnclosingCallable ( ) = api and
713- p . ( NodeExtended ) . getEnclosingCallable ( ) = api and
712+ getEnclosingCallable ( returnNodeExt ) = api and
713+ getEnclosingCallable ( p ) = api and
714714 p = api .getARelevantParameterNode ( )
715715 }
716716
@@ -982,7 +982,8 @@ module MakeModelGenerator<
982982 }
983983
984984 predicate isSink ( DataFlow:: Node sink ) {
985- sink .( ReturnNodeExt ) .getEnclosingCallable ( ) instanceof DataFlowSourceTargetApi
985+ sink instanceof ReturnNodeExt and
986+ getEnclosingCallable ( sink ) instanceof DataFlowSourceTargetApi
986987 }
987988
988989 DataFlow:: FlowFeature getAFeature ( ) { result instanceof DataFlow:: FeatureHasSinkCallContext }
@@ -1005,8 +1006,8 @@ module MakeModelGenerator<
10051006 exists ( NodeExtended source , ReturnNodeExt sink , string kind |
10061007 PropagateFromSource:: flow ( source , sink ) and
10071008 sourceNode ( source , kind ) and
1008- api = sink . getEnclosingCallable ( ) and
1009- not irrelevantSourceSinkApi ( source . getEnclosingCallable ( ) , api ) and
1009+ api = getEnclosingCallable ( sink ) and
1010+ not irrelevantSourceSinkApi ( getEnclosingCallable ( source ) , api ) and
10101011 result = ModelPrinting:: asSourceModel ( api , getOutput ( sink ) , kind )
10111012 )
10121013 }
@@ -1021,7 +1022,7 @@ module MakeModelGenerator<
10211022 module PropagateToSinkConfig implements DataFlow:: ConfigSig {
10221023 predicate isSource ( DataFlow:: Node source ) {
10231024 apiSource ( source ) and
1024- source . ( NodeExtended ) . getEnclosingCallable ( ) instanceof DataFlowSinkTargetApi
1025+ getEnclosingCallable ( source ) instanceof DataFlowSinkTargetApi
10251026 }
10261027
10271028 predicate isSink ( DataFlow:: Node sink ) {
@@ -1050,7 +1051,7 @@ module MakeModelGenerator<
10501051 exists ( NodeExtended src , NodeExtended sink , string kind |
10511052 PropagateToSink:: flow ( src , sink ) and
10521053 sinkNode ( sink , kind ) and
1053- api = src . getEnclosingCallable ( ) and
1054+ api = getEnclosingCallable ( src ) and
10541055 result = ModelPrinting:: asSinkModel ( api , asInputArgument ( src ) , kind )
10551056 )
10561057 }
0 commit comments