@@ -498,10 +498,13 @@ import ArgumentPassing
498498 */
499499newtype TDataFlowCallable =
500500 TCallableValue ( CallableValue callable ) {
501- callable instanceof FunctionValue
501+ callable instanceof FunctionValue and
502+ // TODO: push into FunctionValue
503+ not callable .( FunctionValue ) .getOrigin ( ) .getNode ( ) instanceof Lambda
502504 or
503505 callable instanceof ClassValue
504506 } or
507+ TLambda ( Function lambda ) { lambda .getName ( ) = "lambda" } or
505508 TModule ( Module m )
506509
507510/** Represents a callable. */
@@ -544,6 +547,27 @@ class DataFlowCallableValue extends DataFlowCallable, TCallableValue {
544547 override CallableValue getCallableValue ( ) { result = callable }
545548}
546549
550+ /** A class representing a callable lambda. */
551+ class DataFlowLambda extends DataFlowCallable , TLambda {
552+ Function lambda ;
553+
554+ DataFlowLambda ( ) { this = TLambda ( lambda ) }
555+
556+ override string toString ( ) { result = lambda .toString ( ) }
557+
558+ override CallNode getACall ( ) { result = getCallableValue ( ) .getACall ( ) }
559+
560+ override Scope getScope ( ) { result = lambda .getEvaluatingScope ( ) }
561+
562+ override NameNode getParameter ( int n ) { result = getParameter ( getCallableValue ( ) , n ) }
563+
564+ override string getName ( ) { result = "Lambda callable" }
565+
566+ override CallableValue getCallableValue ( ) {
567+ result .( FunctionValue ) .getOrigin ( ) .getNode ( ) = lambda .getDefinition ( )
568+ }
569+ }
570+
547571/** A class representing the scope in which a `ModuleVariableNode` appears. */
548572class DataFlowModuleScope extends DataFlowCallable , TModule {
549573 Module mod ;
0 commit comments