@@ -597,22 +597,25 @@ predicate isUnreachableInCall(NodeRegion nr, DataFlowCall call) { none() }
597597
598598newtype LambdaCallKind = TLambdaCallKind ( )
599599
600- /** Holds if `creation` is an expression that creates a lambda of kind `kind` for `c`. */
601- predicate lambdaCreation ( Node creation , LambdaCallKind kind , DataFlowCallable c ) { none ( ) }
600+ private class CmdName extends StringConstExpr {
601+ CmdName ( ) { this = any ( Cmd c ) . getCmdName ( ) }
602602
603- /**
604- * Holds if `call` is a from-source lambda call of kind `kind` where `receiver`
605- * is the lambda expression.
606- */
607- predicate lambdaSourceCall ( CfgNodes:: StmtNodes:: CmdCfgNode call , LambdaCallKind kind , Node receiver ) {
608- none ( )
603+ string getName ( ) { result = this .getValue ( ) .getValue ( ) }
604+ }
605+
606+ /** Holds if `creation` is an expression that creates a lambda of kind `kind` for `c`. */
607+ predicate lambdaCreation ( Node creation , LambdaCallKind kind , DataFlowCallable c ) {
608+ creation .asExpr ( ) .getExpr ( ) .( CmdName ) .getName ( ) = c .asCfgScope ( ) .getEnclosingFunction ( ) .getName ( ) and
609+ exists ( kind )
609610}
610611
611612/**
612613 * Holds if `call` is a (from-source or from-summary) lambda call of kind `kind`
613614 * where `receiver` is the lambda expression.
614615 */
615- predicate lambdaCall ( DataFlowCall call , LambdaCallKind kind , Node receiver ) { none ( ) }
616+ predicate lambdaCall ( DataFlowCall call , LambdaCallKind kind , Node receiver ) {
617+ call .asCall ( ) .getCommand ( ) = receiver .asExpr ( ) and exists ( kind )
618+ }
616619
617620/** Extra data-flow steps needed for lambda flow analysis. */
618621predicate additionalLambdaFlowStep ( Node nodeFrom , Node nodeTo , boolean preservesValue ) { none ( ) }
0 commit comments