@@ -262,6 +262,23 @@ private module Cached {
262
262
cached
263
263
predicate isUnreachableInCallCached ( Node n , DataFlowCall call ) { isUnreachableInCall ( n , call ) }
264
264
265
+ cached
266
+ predicate outNodeExt ( Node n ) {
267
+ n instanceof OutNode
268
+ or
269
+ n .( PostUpdateNode ) .getPreUpdateNode ( ) instanceof ArgumentNode
270
+ }
271
+
272
+ cached
273
+ OutNodeExt getAnOutNodeExt ( DataFlowCall call , ReturnKindExt k ) {
274
+ result = getAnOutNode ( call , k .( ValueReturnKind ) .getKind ( ) )
275
+ or
276
+ exists ( ArgumentNode arg |
277
+ result .( PostUpdateNode ) .getPreUpdateNode ( ) = arg and
278
+ arg .argumentOf ( call , k .( ParamUpdateReturnKind ) .getPosition ( ) )
279
+ )
280
+ }
281
+
265
282
/**
266
283
* Gets a viable target for the lambda call `call`.
267
284
*
@@ -970,11 +987,7 @@ class ReturnNodeExt extends Node {
970
987
* or a post-update node associated with a call argument.
971
988
*/
972
989
class OutNodeExt extends Node {
973
- OutNodeExt ( ) {
974
- this instanceof OutNode
975
- or
976
- this .( PostUpdateNode ) .getPreUpdateNode ( ) instanceof ArgumentNode
977
- }
990
+ OutNodeExt ( ) { outNodeExt ( this ) }
978
991
}
979
992
980
993
/**
@@ -987,7 +1000,7 @@ abstract class ReturnKindExt extends TReturnKindExt {
987
1000
abstract string toString ( ) ;
988
1001
989
1002
/** Gets a node corresponding to data flow out of `call`. */
990
- abstract OutNodeExt getAnOutNode ( DataFlowCall call ) ;
1003
+ final OutNodeExt getAnOutNode ( DataFlowCall call ) { result = getAnOutNodeExt ( call , this ) }
991
1004
}
992
1005
993
1006
class ValueReturnKind extends ReturnKindExt , TValueReturn {
@@ -998,10 +1011,6 @@ class ValueReturnKind extends ReturnKindExt, TValueReturn {
998
1011
ReturnKind getKind ( ) { result = kind }
999
1012
1000
1013
override string toString ( ) { result = kind .toString ( ) }
1001
-
1002
- override OutNodeExt getAnOutNode ( DataFlowCall call ) {
1003
- result = getAnOutNode ( call , this .getKind ( ) )
1004
- }
1005
1014
}
1006
1015
1007
1016
class ParamUpdateReturnKind extends ReturnKindExt , TParamUpdate {
@@ -1012,13 +1021,6 @@ class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
1012
1021
int getPosition ( ) { result = pos }
1013
1022
1014
1023
override string toString ( ) { result = "param update " + pos }
1015
-
1016
- override OutNodeExt getAnOutNode ( DataFlowCall call ) {
1017
- exists ( ArgumentNode arg |
1018
- result .( PostUpdateNode ) .getPreUpdateNode ( ) = arg and
1019
- arg .argumentOf ( call , this .getPosition ( ) )
1020
- )
1021
- }
1022
1024
}
1023
1025
1024
1026
/** A callable tagged with a relevant return kind. */
0 commit comments