@@ -163,7 +163,7 @@ class RequiredSummaryComponentStack = Impl::Public::RequiredSummaryComponentStac
163163
164164/**
165165 * 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,
167167 * we are assuming that callbacks passed into library methods will be called, which is
168168 * needed for flow through captured variables.
169169 */
@@ -172,21 +172,6 @@ private module LibraryCallbackSummaries {
172172 not exists ( getTarget ( call ) )
173173 }
174174
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-
190175 private DataFlow:: LocalSourceNode trackLambdaCreation ( TypeTracker t ) {
191176 t .start ( ) and
192177 lambdaCreation ( result , TLambdaCallKind ( ) , _)
@@ -205,20 +190,26 @@ private module LibraryCallbackSummaries {
205190 }
206191
207192 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>" }
214194
215195 final override MethodCall getACall ( ) {
216- libraryCallHasLambdaArg ( result .getAControlFlowNode ( ) , i )
196+ libraryCall ( result .getAControlFlowNode ( ) ) and
197+ result .hasBlock ( )
198+ or
199+ libraryCallHasLambdaArg ( result .getAControlFlowNode ( ) , _)
217200 }
218201
219202 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
222213 preservesValue = true
223214 }
224215 }
0 commit comments