diff --git a/src/script_opt/CPP/Driver.cc b/src/script_opt/CPP/Driver.cc index a93b0f603b..2cecb4923c 100644 --- a/src/script_opt/CPP/Driver.cc +++ b/src/script_opt/CPP/Driver.cc @@ -77,8 +77,9 @@ void CPPCompile::Compile(bool report_uncompilable) continue; } - if ( is_when_lambda(f) ) + if ( is_lambda(f) || is_when_lambda(f) ) { + // We deal with these separately. func.SetSkip(true); continue; } diff --git a/src/script_opt/ScriptOpt.cc b/src/script_opt/ScriptOpt.cc index f01ae2db1f..1b085a9dc2 100644 --- a/src/script_opt/ScriptOpt.cc +++ b/src/script_opt/ScriptOpt.cc @@ -58,6 +58,11 @@ void analyze_when_lambda(LambdaExpr* l) when_lambdas.insert(l->PrimaryFunc().get()); } +bool is_lambda(const ScriptFunc* f) + { + return lambdas.count(f) > 0; + } + bool is_when_lambda(const ScriptFunc* f) { return when_lambdas.count(f) > 0; diff --git a/src/script_opt/ScriptOpt.h b/src/script_opt/ScriptOpt.h index 0e8e0ed09f..1a6145f243 100644 --- a/src/script_opt/ScriptOpt.h +++ b/src/script_opt/ScriptOpt.h @@ -174,7 +174,8 @@ extern void analyze_lambda(LambdaExpr* f); // has already been called. extern void analyze_when_lambda(LambdaExpr* f); -// Whether a given script function is a "when" lambda. +// Whether a given script function is a lambda or (separately) a "when" lambda. +extern bool is_lambda(const ScriptFunc* f); extern bool is_when_lambda(const ScriptFunc* f); // Analyze the given top-level statement(s) for optimization. Returns