mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +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
|
@ -130,15 +130,6 @@ TraversalCode ProfileFunc::PreStmt(const Stmt* s)
|
|||
|
||||
case STMT_WHEN:
|
||||
++num_when_stmts;
|
||||
|
||||
in_when = true;
|
||||
s->AsWhenStmt()->Cond()->Traverse(this);
|
||||
in_when = false;
|
||||
|
||||
// It doesn't do any harm for us to re-traverse the
|
||||
// conditional, so we don't bother hand-traversing the
|
||||
// rest of the "when", but just let the usual processing
|
||||
// do it.
|
||||
break;
|
||||
|
||||
case STMT_FOR:
|
||||
|
@ -283,13 +274,26 @@ TraversalCode ProfileFunc::PreExpr(const Expr* e)
|
|||
case EXPR_REMOVE_FROM:
|
||||
case EXPR_ASSIGN:
|
||||
{
|
||||
if ( e->GetOp1()->Tag() == EXPR_REF )
|
||||
if ( e->GetOp1()->Tag() != EXPR_REF )
|
||||
// this isn't a direct assignment
|
||||
break;
|
||||
|
||||
auto lhs = e->GetOp1()->GetOp1();
|
||||
if ( lhs->Tag() != EXPR_NAME )
|
||||
break;
|
||||
|
||||
auto id = lhs->AsNameExpr()->Id();
|
||||
TrackAssignment(id);
|
||||
|
||||
if ( e->Tag() == EXPR_ASSIGN )
|
||||
{
|
||||
auto lhs = e->GetOp1()->GetOp1();
|
||||
if ( lhs->Tag() == EXPR_NAME )
|
||||
TrackAssignment(lhs->AsNameExpr()->Id());
|
||||
auto a_e = static_cast<const AssignExpr*>(e);
|
||||
auto& av = a_e->AssignVal();
|
||||
if ( av )
|
||||
// This is a funky "local" assignment
|
||||
// inside a when clause.
|
||||
when_locals.insert(id);
|
||||
}
|
||||
// else this isn't a direct assignment.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -324,9 +328,6 @@ TraversalCode ProfileFunc::PreExpr(const Expr* e)
|
|||
{
|
||||
auto bf = static_cast<ScriptFunc*>(func_vf);
|
||||
script_calls.insert(bf);
|
||||
|
||||
if ( in_when )
|
||||
when_calls.insert(bf);
|
||||
}
|
||||
else
|
||||
BiF_globals.insert(func);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue