@@ -155,7 +155,7 @@ private predicate variableReadActual(BasicBlock bb, int i, Variable v) {
155
155
*/
156
156
pragma [ noinline]
157
157
private predicate hasCapturedWrite ( Variable v , Cfg:: CfgScope scope ) {
158
- any ( VariableWriteAccess write | write .getVariable ( ) = v and scope = write .getEnclosingCallable * ( ) )
158
+ any ( VariableWriteAccess write | write .getVariable ( ) = v and scope = write .getEnclosingCallable + ( ) )
159
159
.isCapture ( )
160
160
}
161
161
@@ -262,7 +262,7 @@ private predicate readsCapturedVariable(BasicBlock bb, Variable v) {
262
262
*/
263
263
pragma [ noinline]
264
264
private predicate hasCapturedRead ( Variable v , Cfg:: CfgScope scope ) {
265
- any ( VariableReadAccess read | read .getVariable ( ) = v and scope = read .getEnclosingCallable * ( ) )
265
+ any ( VariableReadAccess read | read .getVariable ( ) = v and scope = read .getEnclosingCallable + ( ) )
266
266
.isCapture ( )
267
267
}
268
268
@@ -290,6 +290,19 @@ private predicate capturedCallRead(CallExprBase call, BasicBlock bb, int i, Vari
290
290
)
291
291
}
292
292
293
+ /**
294
+ * Holds if the call `call` at index `i` in basic block `bb` may reach a callable
295
+ * that writes captured variable `v`.
296
+ */
297
+ predicate capturedCallWrite ( CallExprBase call , BasicBlock bb , int i , Variable v ) {
298
+ call = bb .getNode ( i ) .getAstNode ( ) and
299
+ exists ( Cfg:: CfgScope scope |
300
+ hasVariableReadWithCapturedWrite ( bb , any ( int j | j > i ) , v , scope )
301
+ or
302
+ hasVariableReadWithCapturedWrite ( bb .getASuccessor + ( ) , _, v , scope )
303
+ )
304
+ }
305
+
293
306
/**
294
307
* Holds if a pseudo read of captured variable `v` should be inserted
295
308
* at index `i` in exit block `bb`.
@@ -312,20 +325,6 @@ private module Cached {
312
325
i = - 1
313
326
}
314
327
315
- /**
316
- * Holds if the call `call` at index `i` in basic block `bb` may reach a callable
317
- * that writes captured variable `v`.
318
- */
319
- cached
320
- predicate capturedCallWrite ( CallExprBase call , BasicBlock bb , int i , Variable v ) {
321
- call = bb .getNode ( i ) .getAstNode ( ) and
322
- exists ( Cfg:: CfgScope scope |
323
- hasVariableReadWithCapturedWrite ( bb , any ( int j | j > i ) , v , scope )
324
- or
325
- hasVariableReadWithCapturedWrite ( bb .getASuccessor + ( ) , _, v , scope )
326
- )
327
- }
328
-
329
328
/**
330
329
* Holds if `v` is written at index `i` in basic block `bb`, and the corresponding
331
330
* AST write access is `write`.
0 commit comments