@@ -102,18 +102,18 @@ final class ParameterPosition extends TParameterPosition {
102
102
predicate isSelf ( ) { this = TSelfParameterPosition ( ) }
103
103
104
104
/**
105
- * Holds if this position represents a reference to a lambda itself. Only
105
+ * Holds if this position represents a reference to a closure itself. Only
106
106
* used for tracking flow through captured variables.
107
107
*/
108
- predicate isLambdaSelf ( ) { this = TLambdaSelfParameterPosition ( ) }
108
+ predicate isClosureSelf ( ) { this = TClosureSelfParameterPosition ( ) }
109
109
110
110
/** Gets a textual representation of this position. */
111
111
string toString ( ) {
112
112
result = this .getPosition ( ) .toString ( )
113
113
or
114
114
result = "self" and this .isSelf ( )
115
115
or
116
- result = "lambda self" and this .isLambdaSelf ( )
116
+ result = "closure self" and this .isClosureSelf ( )
117
117
}
118
118
119
119
ParamBase getParameterIn ( ParamList ps ) {
@@ -276,15 +276,15 @@ module Node {
276
276
* The run-time representation of a closure itself at function entry, viewed
277
277
* as a node in a data flow graph.
278
278
*/
279
- final class ClosureParameterNode extends ParameterNode , TLambdaSelfReferenceNode {
279
+ final class ClosureParameterNode extends ParameterNode , TClosureSelfReferenceNode {
280
280
private CfgScope cfgScope ;
281
281
282
- ClosureParameterNode ( ) { this = TLambdaSelfReferenceNode ( cfgScope ) }
282
+ ClosureParameterNode ( ) { this = TClosureSelfReferenceNode ( cfgScope ) }
283
283
284
284
final override CfgScope getCfgScope ( ) { result = cfgScope }
285
285
286
286
override predicate isParameterOf ( DataFlowCallable c , ParameterPosition pos ) {
287
- cfgScope = c .asCfgScope ( ) and pos .isLambdaSelf ( )
287
+ cfgScope = c .asCfgScope ( ) and pos .isClosureSelf ( )
288
288
}
289
289
290
290
override Location getLocation ( ) { result = cfgScope .getLocation ( ) }
@@ -331,7 +331,7 @@ module Node {
331
331
332
332
override predicate isArgumentOf ( DataFlowCall call , RustDataFlow:: ArgumentPosition pos ) {
333
333
call .asCallExprCfgNode ( ) = call_ and
334
- pos .isLambdaSelf ( )
334
+ pos .isClosureSelf ( )
335
335
}
336
336
}
337
337
@@ -403,6 +403,24 @@ module Node {
403
403
override DataFlowCall getCall ( ReturnKind kind ) { result = call and kind = kind_ }
404
404
}
405
405
406
+ /**
407
+ * A synthesized data flow node representing a closure object that tracks
408
+ * captured variables.
409
+ */
410
+ class CaptureNode extends Node , TCaptureNode {
411
+ private VariableCapture:: Flow:: SynthesizedCaptureNode cn ;
412
+
413
+ CaptureNode ( ) { this = TCaptureNode ( cn ) }
414
+
415
+ VariableCapture:: Flow:: SynthesizedCaptureNode getSynthesizedCaptureNode ( ) { result = cn }
416
+
417
+ override CfgScope getCfgScope ( ) { result = cn .getEnclosingCallable ( ) }
418
+
419
+ override Location getLocation ( ) { result = cn .getLocation ( ) }
420
+
421
+ override string toString ( ) { result = cn .toString ( ) }
422
+ }
423
+
406
424
/**
407
425
* A node associated with an object after an operation that might have
408
426
* changed its state.
@@ -458,24 +476,6 @@ module Node {
458
476
final override string toString ( ) { result = PostUpdateNode .super .toString ( ) }
459
477
}
460
478
461
- /**
462
- * A synthesized data flow node representing a closure object that tracks
463
- * captured variables.
464
- */
465
- class CaptureNode extends Node , TCaptureNode {
466
- private VariableCapture:: Flow:: SynthesizedCaptureNode cn ;
467
-
468
- CaptureNode ( ) { this = TCaptureNode ( cn ) }
469
-
470
- VariableCapture:: Flow:: SynthesizedCaptureNode getSynthesizedCaptureNode ( ) { result = cn }
471
-
472
- override CfgScope getCfgScope ( ) { result = cn .getEnclosingCallable ( ) }
473
-
474
- override Location getLocation ( ) { result = cn .getLocation ( ) }
475
-
476
- override string toString ( ) { result = cn .toString ( ) }
477
- }
478
-
479
479
final class CastNode = NaNode ;
480
480
}
481
481
@@ -847,8 +847,6 @@ module RustDataFlow implements InputSig<Location> {
847
847
node instanceof Node:: CaptureNode
848
848
or
849
849
node instanceof Node:: ClosureParameterNode
850
- or
851
- node instanceof Node:: ClosureArgumentNode
852
850
}
853
851
854
852
class DataFlowExpr = ExprCfgNode ;
@@ -1383,7 +1381,7 @@ private module Cached {
1383
1381
} or
1384
1382
TSsaNode ( SsaImpl:: DataFlowIntegration:: SsaNode node ) or
1385
1383
TFlowSummaryNode ( FlowSummaryImpl:: Private:: SummaryNode sn ) or
1386
- TLambdaSelfReferenceNode ( CfgScope c ) { lambdaCreationExpr ( c , _) } or
1384
+ TClosureSelfReferenceNode ( CfgScope c ) { lambdaCreationExpr ( c , _) } or
1387
1385
TCaptureNode ( VariableCapture:: Flow:: SynthesizedCaptureNode cn )
1388
1386
1389
1387
cached
@@ -1421,7 +1419,7 @@ private module Cached {
1421
1419
or
1422
1420
FlowSummaryImpl:: ParsePositions:: isParsedParameterPosition ( _, i )
1423
1421
} or
1424
- TLambdaSelfParameterPosition ( ) or
1422
+ TClosureSelfParameterPosition ( ) or
1425
1423
TSelfParameterPosition ( )
1426
1424
1427
1425
cached
0 commit comments