@@ -89,20 +89,20 @@ predicate uninitializedWrite(Cfg::EntryBasicBlock bb, int i, LocalVariable v) {
8989/** Holds if `bb` contains a captured read of variable `v`. */
9090pragma [ noinline]
9191private predicate hasCapturedVariableRead ( Cfg:: BasicBlock bb , LocalVariable v ) {
92- exists ( LocalVariableReadAccess read |
93- read = bb .getANode ( ) . getNode ( ) and
94- read .isCapturedAccess ( ) and
92+ exists ( LocalVariableReadAccessCfgNode read |
93+ read = bb .getANode ( ) and
94+ read .getExpr ( ) . isCapturedAccess ( ) and
9595 read .getVariable ( ) = v
9696 )
9797}
9898
9999/** Holds if `bb` contains a captured write to variable `v`. */
100100pragma [ noinline]
101101private predicate writesCapturedVariable ( Cfg:: BasicBlock bb , LocalVariable v ) {
102- exists ( LocalVariableWriteAccess write |
103- write = bb .getANode ( ) . getNode ( ) and
104- write .isCapturedAccess ( ) and
105- write . getVariable ( ) = v
102+ exists ( LocalVariableWriteAccessCfgNode write |
103+ write = bb .getANode ( ) and
104+ write .getVariable ( ) = v and
105+ v . isCaptured ( )
106106 )
107107}
108108
@@ -137,9 +137,9 @@ private predicate namespaceSelfExitRead(Cfg::AnnotatedExitBasicBlock bb, int i,
137137 */
138138pragma [ noinline]
139139private predicate hasCapturedRead ( Variable v , Cfg:: CfgScope scope ) {
140- any ( LocalVariableReadAccess read |
141- read .getVariable ( ) = v and scope = read .getCfgScope ( ) .getOuterCfgScope * ( )
142- ) .isCapturedAccess ( )
140+ any ( LocalVariableReadAccessCfgNode read |
141+ read .getVariable ( ) = v and scope = read .getScope ( ) .getOuterCfgScope * ( )
142+ ) .getExpr ( ) . isCapturedAccess ( )
143143}
144144
145145/**
@@ -153,11 +153,13 @@ private predicate variableWriteInOuterScope(Cfg::BasicBlock bb, LocalVariable v,
153153}
154154
155155pragma [ noinline]
156- private predicate hasVariableWriteWithCapturedRead (
156+ private predicate proceedsVariableWriteWithCapturedRead (
157157 Cfg:: BasicBlock bb , LocalVariable v , Cfg:: CfgScope scope
158158) {
159159 hasCapturedRead ( v , scope ) and
160160 variableWriteInOuterScope ( bb , v , scope )
161+ or
162+ proceedsVariableWriteWithCapturedRead ( bb .getAPredecessor ( ) , v , scope )
161163}
162164
163165/**
@@ -166,7 +168,7 @@ private predicate hasVariableWriteWithCapturedRead(
166168 */
167169private predicate capturedCallRead ( CallCfgNode call , Cfg:: BasicBlock bb , int i , LocalVariable v ) {
168170 exists ( Cfg:: CfgScope scope |
169- hasVariableWriteWithCapturedRead ( bb . getAPredecessor * ( ) , v , scope ) and
171+ proceedsVariableWriteWithCapturedRead ( bb , v , scope ) and
170172 call = bb .getNode ( i )
171173 |
172174 // If the read happens inside a block, we restrict to the call that
@@ -191,9 +193,9 @@ private predicate variableReadActual(Cfg::BasicBlock bb, int i, LocalVariable v)
191193 */
192194pragma [ noinline]
193195private predicate hasCapturedWrite ( Variable v , Cfg:: CfgScope scope ) {
194- any ( LocalVariableWriteAccess write |
195- write .getVariable ( ) = v and scope = write .getCfgScope ( ) .getOuterCfgScope * ( )
196- ) .isCapturedAccess ( )
196+ any ( LocalVariableWriteAccessCfgNode write |
197+ write .getVariable ( ) = v and scope = write .getScope ( ) .getOuterCfgScope * ( )
198+ ) .getExpr ( ) . isCapturedAccess ( )
197199}
198200
199201/**
@@ -339,11 +341,11 @@ private module Cached {
339341 */
340342 cached
341343 predicate variableWriteActual (
342- Cfg:: BasicBlock bb , int i , LocalVariable v , VariableWriteAccess write
344+ Cfg:: BasicBlock bb , int i , LocalVariable v , VariableWriteAccessCfgNode write
343345 ) {
344- exists ( AstNode n |
346+ exists ( Cfg :: CfgNode n |
345347 write .getVariable ( ) = v and
346- n = bb .getNode ( i ) . getNode ( )
348+ n = bb .getNode ( i )
347349 |
348350 write .isExplicitWrite ( n )
349351 or
0 commit comments