@@ -116,17 +116,23 @@ private module Cached {
116
116
cached
117
117
DataFlowCallable viableCallable ( DataFlowCall call ) { result = call .getARuntimeTarget ( ) }
118
118
119
+ private predicate capturedWithFlowIn ( LocalScopeVariable v ) {
120
+ exists ( Ssa:: ExplicitDefinition def | def .isCapturedVariableDefinitionFlowIn ( _, _, _) |
121
+ v = def .getSourceVariable ( ) .getAssignable ( )
122
+ )
123
+ }
124
+
119
125
cached
120
126
newtype TParameterPosition =
121
127
TPositionalParameterPosition ( int i ) { i = any ( Parameter p ) .getPosition ( ) } or
122
128
TThisParameterPosition ( ) or
123
- TImplicitCapturedParameterPosition ( SsaCapturedEntryDefinition def )
129
+ TImplicitCapturedParameterPosition ( LocalScopeVariable v ) { capturedWithFlowIn ( v ) }
124
130
125
131
cached
126
132
newtype TArgumentPosition =
127
133
TPositionalArgumentPosition ( int i ) { i = any ( Parameter p ) .getPosition ( ) } or
128
134
TQualifierArgumentPosition ( ) or
129
- TImplicitCapturedArgumentPosition ( SsaCapturedEntryDefinition def )
135
+ TImplicitCapturedArgumentPosition ( LocalScopeVariable v ) { capturedWithFlowIn ( v ) }
130
136
}
131
137
132
138
import Cached
@@ -432,8 +438,8 @@ class ParameterPosition extends TParameterPosition {
432
438
predicate isThisParameter ( ) { this = TThisParameterPosition ( ) }
433
439
434
440
/** Holds if this position is used to model flow through captured variables. */
435
- predicate isImplicitCapturedParameterPosition ( SsaCapturedEntryDefinition def ) {
436
- this = TImplicitCapturedParameterPosition ( def )
441
+ predicate isImplicitCapturedParameterPosition ( LocalScopeVariable v ) {
442
+ this = TImplicitCapturedParameterPosition ( v )
437
443
}
438
444
439
445
/** Gets a textual representation of this position. */
@@ -442,8 +448,8 @@ class ParameterPosition extends TParameterPosition {
442
448
or
443
449
this .isThisParameter ( ) and result = "this"
444
450
or
445
- exists ( SsaCapturedEntryDefinition def |
446
- this .isImplicitCapturedParameterPosition ( def ) and result = "captured " + def
451
+ exists ( LocalScopeVariable v |
452
+ this .isImplicitCapturedParameterPosition ( v ) and result = "captured " + v
447
453
)
448
454
}
449
455
}
@@ -457,8 +463,8 @@ class ArgumentPosition extends TArgumentPosition {
457
463
predicate isQualifier ( ) { this = TQualifierArgumentPosition ( ) }
458
464
459
465
/** Holds if this position is used to model flow through captured variables. */
460
- predicate isImplicitCapturedArgumentPosition ( SsaCapturedEntryDefinition def ) {
461
- this = TImplicitCapturedArgumentPosition ( def )
466
+ predicate isImplicitCapturedArgumentPosition ( LocalScopeVariable v ) {
467
+ this = TImplicitCapturedArgumentPosition ( v )
462
468
}
463
469
464
470
/** Gets a textual representation of this position. */
@@ -467,8 +473,8 @@ class ArgumentPosition extends TArgumentPosition {
467
473
or
468
474
this .isQualifier ( ) and result = "qualifier"
469
475
or
470
- exists ( SsaCapturedEntryDefinition def |
471
- this .isImplicitCapturedArgumentPosition ( def ) and result = "captured " + def
476
+ exists ( LocalScopeVariable v |
477
+ this .isImplicitCapturedArgumentPosition ( v ) and result = "captured " + v
472
478
)
473
479
}
474
480
}
@@ -479,8 +485,8 @@ predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) {
479
485
or
480
486
ppos .isThisParameter ( ) and apos .isQualifier ( )
481
487
or
482
- exists ( SsaCapturedEntryDefinition def |
483
- ppos .isImplicitCapturedParameterPosition ( def ) and
484
- apos .isImplicitCapturedArgumentPosition ( def )
488
+ exists ( LocalScopeVariable v |
489
+ ppos .isImplicitCapturedParameterPosition ( v ) and
490
+ apos .isImplicitCapturedArgumentPosition ( v )
485
491
)
486
492
}
0 commit comments