script optimization support for "add" and "delete" being expressions

This commit is contained in:
Vern Paxson 2024-05-16 14:37:30 -07:00 committed by Tim Wojtulewicz
parent 0e5bece385
commit 37c1f6641c
11 changed files with 132 additions and 144 deletions

View file

@ -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) {