mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Merge remote-tracking branch 'origin/topic/vern/when-lambda'
* origin/topic/vern/when-lambda: explicitly provide the frame for evaluating a "when" timeout expression attempt to make "when" btest deterministic tests for new "when" semantics/errors update existing test suite usage of "when" statements to include captures update uses of "when" in base scripts to include captures captures for "when" statements update Triggers to IntrusivePtr's and simpler AST traversal introduce IDSet type, migrate associated "ID*" types to "const ID*" logic (other than in profiling) for assignments that yield separate values option for internal use to mark a function type as allowing non-expression returns removed some now-obsolete profiling functionality minor commenting clarifications
This commit is contained in:
commit
3d9d6e953b
56 changed files with 931 additions and 255 deletions
|
@ -435,7 +435,7 @@ private:
|
|||
std::unordered_map<std::string, std::string> events;
|
||||
|
||||
// Globals that correspond to variables, not functions.
|
||||
std::unordered_set<const ID*> global_vars;
|
||||
IDSet global_vars;
|
||||
|
||||
//
|
||||
// End of methods related to script/C++ variables.
|
||||
|
@ -539,7 +539,7 @@ private:
|
|||
std::unordered_map<const ID*, std::string> lambda_names;
|
||||
|
||||
// The function's parameters. Tracked so we don't re-declare them.
|
||||
std::unordered_set<const ID*> params;
|
||||
IDSet params;
|
||||
|
||||
// Whether we're compiling a hook.
|
||||
bool in_hook = false;
|
||||
|
|
|
@ -461,7 +461,16 @@ string CPPCompile::GenAssignExpr(const Expr* e, GenType gt, bool top_level)
|
|||
if ( rhs_is_any && ! lhs_is_any && t1->Tag() != TYPE_LIST )
|
||||
rhs_native = rhs_val_ptr = GenericValPtrToGT(rhs_val_ptr, t1, GEN_NATIVE);
|
||||
|
||||
return GenAssign(op1, op2, rhs_native, rhs_val_ptr, gt, top_level);
|
||||
auto gen = GenAssign(op1, op2, rhs_native, rhs_val_ptr, gt, top_level);
|
||||
auto av = e->AsAssignExpr()->AssignVal();
|
||||
if ( av )
|
||||
{
|
||||
auto av_e = make_intrusive<ConstExpr>(av);
|
||||
auto av_gen = GenExpr(av_e, gt, false);
|
||||
return string("(") + gen + ", " + av_gen + ")";
|
||||
}
|
||||
else
|
||||
return gen;
|
||||
}
|
||||
|
||||
string CPPCompile::GenAddToExpr(const Expr* e, GenType gt, bool top_level)
|
||||
|
|
|
@ -149,7 +149,7 @@ void CPPCompile::InitializeEvents(const ProfileFunc* pf)
|
|||
void CPPCompile::DeclareLocals(const ProfileFunc* pf, const IDPList* lambda_ids)
|
||||
{
|
||||
// It's handy to have a set of the lambda captures rather than a list.
|
||||
unordered_set<const ID*> lambda_set;
|
||||
IDSet lambda_set;
|
||||
if ( lambda_ids )
|
||||
for ( auto li : *lambda_ids )
|
||||
lambda_set.insert(li);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue