@@ -279,6 +279,17 @@ private module Cached {
279
279
)
280
280
}
281
281
282
+ cached
283
+ predicate returnNodeExt ( Node n , ReturnKindExt k ) {
284
+ k = TValueReturn ( n .( ReturnNode ) .getKind ( ) )
285
+ or
286
+ exists ( ParameterNode p , int pos |
287
+ parameterValueFlowsToPreUpdate ( p , n ) and
288
+ p .isParameterOf ( _, pos ) and
289
+ k = TParamUpdate ( pos )
290
+ )
291
+ }
292
+
282
293
/**
283
294
* Gets a viable target for the lambda call `call`.
284
295
*
@@ -672,8 +683,7 @@ private module Cached {
672
683
* Holds if `p` can flow to the pre-update node associated with post-update
673
684
* node `n`, in the same callable, using only value-preserving steps.
674
685
*/
675
- cached
676
- predicate parameterValueFlowsToPreUpdate ( ParameterNode p , PostUpdateNode n ) {
686
+ private predicate parameterValueFlowsToPreUpdate ( ParameterNode p , PostUpdateNode n ) {
677
687
parameterValueFlow ( p , n .getPreUpdateNode ( ) , TReadStepTypesNone ( ) )
678
688
}
679
689
@@ -965,21 +975,10 @@ LocalCallContext getLocalCallContext(CallContext ctx, DataFlowCallable callable)
965
975
* `ReturnNode` or a `PostUpdateNode` corresponding to the value of a parameter.
966
976
*/
967
977
class ReturnNodeExt extends Node {
968
- ReturnNodeExt ( ) {
969
- this instanceof ReturnNode or
970
- parameterValueFlowsToPreUpdate ( _, this )
971
- }
978
+ ReturnNodeExt ( ) { returnNodeExt ( this , _) }
972
979
973
980
/** Gets the kind of this returned value. */
974
- ReturnKindExt getKind ( ) {
975
- result = TValueReturn ( this .( ReturnNode ) .getKind ( ) )
976
- or
977
- exists ( ParameterNode p , int pos |
978
- parameterValueFlowsToPreUpdate ( p , this ) and
979
- p .isParameterOf ( _, pos ) and
980
- result = TParamUpdate ( pos )
981
- )
982
- }
981
+ ReturnKindExt getKind ( ) { returnNodeExt ( this , result ) }
983
982
}
984
983
985
984
/**
0 commit comments