@@ -118,7 +118,7 @@ private module LambdaFlow {
118
118
boolean toJump , DataFlowCallOption lastCall
119
119
) {
120
120
revLambdaFlow0 ( lambdaCall , kind , node , t , toReturn , toJump , lastCall ) and
121
- if node instanceof CastNode or node instanceof ArgumentNode or node instanceof ReturnNode
121
+ if castNode ( node ) or node instanceof ArgumentNode or node instanceof ReturnNode
122
122
then compatibleTypes ( t , getNodeDataFlowType ( node ) )
123
123
else any ( )
124
124
}
@@ -290,6 +290,20 @@ private module Cached {
290
290
)
291
291
}
292
292
293
+ cached
294
+ predicate castNode ( Node n ) { n instanceof CastNode }
295
+
296
+ cached
297
+ predicate castingNode ( Node n ) {
298
+ castNode ( n ) or
299
+ n instanceof ParameterNode or
300
+ n instanceof OutNodeExt or
301
+ // For reads, `x.f`, we want to check that the tracked type after the read (which
302
+ // is obtained by popping the head of the access path stack) is compatible with
303
+ // the type of `x.f`.
304
+ read ( _, _, n )
305
+ }
306
+
293
307
/**
294
308
* Gets a viable target for the lambda call `call`.
295
309
*
@@ -818,15 +832,7 @@ private module Cached {
818
832
* A `Node` at which a cast can occur such that the type should be checked.
819
833
*/
820
834
class CastingNode extends Node {
821
- CastingNode ( ) {
822
- this instanceof ParameterNode or
823
- this instanceof CastNode or
824
- this instanceof OutNodeExt or
825
- // For reads, `x.f`, we want to check that the tracked type after the read (which
826
- // is obtained by popping the head of the access path stack) is compatible with
827
- // the type of `x.f`.
828
- read ( _, _, this )
829
- }
835
+ CastingNode ( ) { castingNode ( this ) }
830
836
}
831
837
832
838
private predicate readStepWithTypes (
0 commit comments