mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
captures for "when" statements
update Triggers to IntrusivePtr's and simpler AST traversal introduce IDSet type, migrate associated "ID*" types to "const ID*"
This commit is contained in:
parent
fa142438fe
commit
f895008c34
24 changed files with 648 additions and 202 deletions
|
@ -270,13 +270,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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue