@@ -262,6 +262,23 @@ private module Cached {
262262 cached
263263 predicate isUnreachableInCallCached ( Node n , DataFlowCall call ) { isUnreachableInCall ( n , call ) }
264264
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+
265282 /**
266283 * Gets a viable target for the lambda call `call`.
267284 *
@@ -970,11 +987,7 @@ class ReturnNodeExt extends Node {
970987 * or a post-update node associated with a call argument.
971988 */
972989class OutNodeExt extends Node {
973- OutNodeExt ( ) {
974- this instanceof OutNode
975- or
976- this .( PostUpdateNode ) .getPreUpdateNode ( ) instanceof ArgumentNode
977- }
990+ OutNodeExt ( ) { outNodeExt ( this ) }
978991}
979992
980993/**
@@ -987,7 +1000,7 @@ abstract class ReturnKindExt extends TReturnKindExt {
9871000 abstract string toString ( ) ;
9881001
9891002 /** 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 ) }
9911004}
9921005
9931006class ValueReturnKind extends ReturnKindExt , TValueReturn {
@@ -998,10 +1011,6 @@ class ValueReturnKind extends ReturnKindExt, TValueReturn {
9981011 ReturnKind getKind ( ) { result = kind }
9991012
10001013 override string toString ( ) { result = kind .toString ( ) }
1001-
1002- override OutNodeExt getAnOutNode ( DataFlowCall call ) {
1003- result = getAnOutNode ( call , this .getKind ( ) )
1004- }
10051014}
10061015
10071016class ParamUpdateReturnKind extends ReturnKindExt , TParamUpdate {
@@ -1012,13 +1021,6 @@ class ParamUpdateReturnKind extends ReturnKindExt, TParamUpdate {
10121021 int getPosition ( ) { result = pos }
10131022
10141023 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- }
10221024}
10231025
10241026/** A callable tagged with a relevant return kind. */
0 commit comments