mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
fixes for compiling lambdas to C++
This commit is contained in:
parent
4991693a9c
commit
6af0014a7b
3 changed files with 9 additions and 2 deletions
|
@ -77,8 +77,9 @@ void CPPCompile::Compile(bool report_uncompilable)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_when_lambda(f) )
|
if ( is_lambda(f) || is_when_lambda(f) )
|
||||||
{
|
{
|
||||||
|
// We deal with these separately.
|
||||||
func.SetSkip(true);
|
func.SetSkip(true);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,11 @@ void analyze_when_lambda(LambdaExpr* l)
|
||||||
when_lambdas.insert(l->PrimaryFunc().get());
|
when_lambdas.insert(l->PrimaryFunc().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_lambda(const ScriptFunc* f)
|
||||||
|
{
|
||||||
|
return lambdas.count(f) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool is_when_lambda(const ScriptFunc* f)
|
bool is_when_lambda(const ScriptFunc* f)
|
||||||
{
|
{
|
||||||
return when_lambdas.count(f) > 0;
|
return when_lambdas.count(f) > 0;
|
||||||
|
|
|
@ -174,7 +174,8 @@ extern void analyze_lambda(LambdaExpr* f);
|
||||||
// has already been called.
|
// has already been called.
|
||||||
extern void analyze_when_lambda(LambdaExpr* f);
|
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);
|
extern bool is_when_lambda(const ScriptFunc* f);
|
||||||
|
|
||||||
// Analyze the given top-level statement(s) for optimization. Returns
|
// Analyze the given top-level statement(s) for optimization. Returns
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue