@@ -24,7 +24,7 @@ class LambdaExpression extends Expr, @lambdaexpr {
24
24
* Gets the nth implicitly or explicitly captured value of this lambda expression.
25
25
*/
26
26
LambdaCapture getCapture ( int index ) {
27
- lambda_capture ( result , underlyingElement ( this ) , index , _, _, _)
27
+ lambda_capture ( result , underlyingElement ( this ) , index , _, _, _, _ )
28
28
}
29
29
30
30
/**
@@ -64,7 +64,7 @@ class LambdaExpression extends Expr, @lambdaexpr {
64
64
* Gets the initializer that initializes the captured variables in the closure, if any.
65
65
* A lambda that does not capture any variables will not have an initializer.
66
66
*/
67
- Expr getInitializer ( ) {
67
+ ClassAggregateLiteral getInitializer ( ) {
68
68
result = getChild ( 0 )
69
69
}
70
70
}
@@ -109,7 +109,7 @@ class LambdaCapture extends @lambdacapture {
109
109
* Holds if this capture was made implicitly.
110
110
*/
111
111
predicate isImplicit ( ) {
112
- lambda_capture ( this , _, _, _, true , _)
112
+ lambda_capture ( this , _, _, _, _ , true , _)
113
113
}
114
114
115
115
/**
@@ -122,7 +122,7 @@ class LambdaCapture extends @lambdacapture {
122
122
* is actually "*this" being captured rather than "this".]
123
123
*/
124
124
predicate isCapturedByReference ( ) {
125
- lambda_capture ( this , _, _, true , _, _)
125
+ lambda_capture ( this , _, _, _ , true , _, _)
126
126
}
127
127
128
128
/**
@@ -134,16 +134,14 @@ class LambdaCapture extends @lambdacapture {
134
134
* expression which accesses the captured variable.
135
135
*/
136
136
Location getLocation ( ) {
137
- lambda_capture ( this , _, _, _, _, result )
137
+ lambda_capture ( this , _, _, _, _, _ , result )
138
138
}
139
139
140
140
/**
141
141
* Gets the field of the lambda expression's closure type which is used to store this capture.
142
142
*/
143
143
MemberVariable getField ( ) {
144
- exists ( LambdaExpression lambda , int index | this = lambda .getCapture ( index ) |
145
- result = lambda .getType ( ) .( Closure ) .getCanonicalMember ( index )
146
- )
144
+ lambda_capture ( this , _, _, result , _, _, _)
147
145
}
148
146
149
147
/**
@@ -154,9 +152,8 @@ class LambdaCapture extends @lambdacapture {
154
152
* For by-value captures of non-primitive types, this will be a call to a copy constructor.
155
153
*/
156
154
Expr getInitializer ( ) {
157
- exists ( LambdaExpression lambda , int index | this = lambda .getCapture ( index ) |
158
- result = lambda .getChild ( 0 ) // Call to the constructor of the closure type.
159
- .getChild ( index ) // The appropriate argument to the constructor.
155
+ exists ( LambdaExpression lambda | this = lambda .getCapture ( _) |
156
+ result = lambda .getInitializer ( ) .getFieldExpr ( this .getField ( ) )
160
157
)
161
158
}
162
159
}
0 commit comments