@@ -464,7 +464,8 @@ private newtype TDataFlowCall =
464464 TCall ( Call c ) or
465465 TSummaryCall ( SummarizedCallable c , FlowSummaryImpl:: Private:: SummaryNode receiver ) {
466466 FlowSummaryImpl:: Private:: summaryCallbackRange ( c , receiver )
467- }
467+ } or
468+ TLambdaSynthCall ( Node node ) { lambdaCreationHelper ( node , _, _) }
468469
469470/** A call relevant for data flow. Includes both source calls and synthesized calls. */
470471class DataFlowCall extends TDataFlowCall {
@@ -526,6 +527,19 @@ class SummaryCall extends DataFlowCall, TSummaryCall {
526527 override Location getLocation ( ) { result = c .getLocation ( ) }
527528}
528529
530+ /** A synthesized call inside a `SummarizedCallable`. */
531+ class LambdaSynthCall extends DataFlowCall , TLambdaSynthCall {
532+ private Node node ;
533+
534+ LambdaSynthCall ( ) { this = TLambdaSynthCall ( node ) }
535+
536+ override DataFlowCallable getEnclosingCallable ( ) { result .asCallable ( ) = node .getEnclosingCallable ( ) }
537+
538+ override string toString ( ) { result = "[synthetic] call to " + node }
539+
540+ override Location getLocation ( ) { result = node .getLocation ( ) }
541+ }
542+
529543class NodeRegion instanceof BasicBlock {
530544 string toString ( ) { result = "NodeRegion" }
531545
@@ -585,8 +599,7 @@ predicate nodeIsHidden(Node n) { n instanceof FlowSummaryNode }
585599
586600class LambdaCallKind = Method ; // the "apply" method in the functional interface
587601
588- /** Holds if `creation` is an expression that creates a lambda of kind `kind` for `c`. */
589- predicate lambdaCreation ( Node creation , LambdaCallKind kind , DataFlowCallable c ) {
602+ predicate lambdaCreationHelper ( Node creation , LambdaCallKind kind , DataFlowCallable c ) {
590603 exists ( ClassInstanceExpr func , Interface t , FunctionalInterface interface |
591604 creation .asExpr ( ) = func and
592605 func .getAnonymousClass ( ) .getAMethod ( ) = c .asCallable ( ) and
@@ -597,6 +610,12 @@ predicate lambdaCreation(Node creation, LambdaCallKind kind, DataFlowCallable c)
597610 )
598611}
599612
613+ /** Holds if `creation` is an expression that creates a lambda of kind `kind` for `c`. */
614+ predicate lambdaCreation ( Node creation , LambdaCallKind kind , DataFlowCallable c , DataFlowCall synthCall ) {
615+ synthCall = TLambdaSynthCall ( creation ) and
616+ lambdaCreationHelper ( creation , kind , c )
617+ }
618+
600619/** Holds if `call` is a lambda call of kind `kind` where `receiver` is the lambda expression. */
601620predicate lambdaCall ( DataFlowCall call , LambdaCallKind kind , Node receiver ) {
602621 receiver .( FlowSummaryNode ) .getSummaryNode ( ) = call .( SummaryCall ) .getReceiver ( ) and
@@ -766,3 +785,15 @@ predicate containerContent(ContentSet c) {
766785 c instanceof MapKeyContent or
767786 c instanceof MapValueContent
768787}
788+
789+ Content getLambdaReturnContent ( LambdaCallKind kind ) {
790+ result = TLambdaReturn ( kind )
791+ }
792+
793+ Content getLambdaArgumentContent ( LambdaCallKind kind , ArgumentPosition pos ) {
794+ result = TLambdaArgument ( kind , pos )
795+ }
796+
797+ predicate isLambdaInstanceParameter ( ParameterNode p ) {
798+ exists ( DataFlowCallable c | lambdaCreationHelper ( _, _, c ) and p .isParameterOf ( c , - 1 ) )
799+ }
0 commit comments