mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
script optimization support for "add" and "delete" being expressions
This commit is contained in:
parent
0e5bece385
commit
37c1f6641c
11 changed files with 132 additions and 144 deletions
|
@ -486,26 +486,6 @@ bool SwitchStmt::CouldReturn(bool ignore_break) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool AddDelStmt::IsReduced(Reducer* c) const { return e->HasReducedOps(c); }
|
||||
|
||||
StmtPtr AddDelStmt::DoReduce(Reducer* c) {
|
||||
if ( c->Optimizing() ) {
|
||||
e = c->OptExpr(e);
|
||||
return ThisPtr();
|
||||
}
|
||||
|
||||
auto red_e_stmt = e->ReduceToSingletons(c);
|
||||
|
||||
if ( red_e_stmt )
|
||||
return TransformMe(make_intrusive<StmtList>(red_e_stmt, ThisPtr()), c);
|
||||
else
|
||||
return ThisPtr();
|
||||
}
|
||||
|
||||
StmtPtr AddStmt::Duplicate() { return SetSucc(new AddStmt(e->Duplicate())); }
|
||||
|
||||
StmtPtr DelStmt::Duplicate() { return SetSucc(new DelStmt(e->Duplicate())); }
|
||||
|
||||
StmtPtr EventStmt::Duplicate() { return SetSucc(new EventStmt(e->Duplicate()->AsEventExprPtr())); }
|
||||
|
||||
StmtPtr EventStmt::DoReduce(Reducer* c) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue