@@ -163,7 +163,7 @@ class RequiredSummaryComponentStack = Impl::Public::RequiredSummaryComponentStac
163
163
164
164
/**
165
165
* Provides a set of special flow summaries to ensure that callbacks passed into
166
- * library methods will be passed as `self` arguments into themeselves . That is,
166
+ * library methods will be passed as `lambda- self` arguments into themselves . That is,
167
167
* we are assuming that callbacks passed into library methods will be called, which is
168
168
* needed for flow through captured variables.
169
169
*/
@@ -172,21 +172,6 @@ private module LibraryCallbackSummaries {
172
172
not exists ( getTarget ( call ) )
173
173
}
174
174
175
- private class LibraryBlockMethod extends SummarizedCallable {
176
- LibraryBlockMethod ( ) { this = "<library method accepting a block>" }
177
-
178
- final override MethodCall getACall ( ) {
179
- libraryCall ( result .getAControlFlowNode ( ) ) and
180
- result .hasBlock ( )
181
- }
182
-
183
- override predicate propagatesFlowExt ( string input , string output , boolean preservesValue ) {
184
- input = "Argument[block]" and
185
- output = "Argument[block].Parameter[lambda-self]" and
186
- preservesValue = true
187
- }
188
- }
189
-
190
175
private DataFlow:: LocalSourceNode trackLambdaCreation ( TypeTracker t ) {
191
176
t .start ( ) and
192
177
lambdaCreation ( result , TLambdaCallKind ( ) , _)
@@ -205,20 +190,26 @@ private module LibraryCallbackSummaries {
205
190
}
206
191
207
192
private class LibraryLambdaMethod extends SummarizedCallable {
208
- private int i ;
209
-
210
- LibraryLambdaMethod ( ) {
211
- this = "<library method accepting a lambda at index " + i + ">" and
212
- i in [ 0 .. 10 ]
213
- }
193
+ LibraryLambdaMethod ( ) { this = "<library method accepting a callback>" }
214
194
215
195
final override MethodCall getACall ( ) {
216
- libraryCallHasLambdaArg ( result .getAControlFlowNode ( ) , i )
196
+ libraryCall ( result .getAControlFlowNode ( ) ) and
197
+ result .hasBlock ( )
198
+ or
199
+ libraryCallHasLambdaArg ( result .getAControlFlowNode ( ) , _)
217
200
}
218
201
219
202
override predicate propagatesFlowExt ( string input , string output , boolean preservesValue ) {
220
- input = "Argument[" + i + "]" and
221
- output = "Argument[" + i + "].Parameter[lambda-self]" and
203
+ (
204
+ input = "Argument[block]" and
205
+ output = "Argument[block].Parameter[lambda-self]"
206
+ or
207
+ exists ( int i |
208
+ i in [ 0 .. 10 ] and
209
+ input = "Argument[" + i + "]" and
210
+ output = "Argument[" + i + "].Parameter[lambda-self]"
211
+ )
212
+ ) and
222
213
preservesValue = true
223
214
}
224
215
}
0 commit comments