script optimization support for clearing tables/vectors using "delete"

This commit is contained in:
Vern Paxson 2024-03-02 14:21:22 -08:00 committed by Arne Welzel
parent ce6d77e2ce
commit 74d36eb759
6 changed files with 37 additions and 8 deletions

View file

@ -591,6 +591,16 @@ const ZAMStmt ZAMCompiler::CompileAdd(const AddStmt* as) {
const ZAMStmt ZAMCompiler::CompileDel(const DelStmt* ds) {
auto e = ds->StmtExprPtr();
if ( e->Tag() == EXPR_NAME ) {
auto n = e->AsNameExpr();
if ( n->GetType()->Tag() == TYPE_TABLE )
return ClearTableV(n);
else
return ClearVectorV(n);
}
auto aggr = e->GetOp1()->AsNameExpr();
if ( e->Tag() == EXPR_FIELD ) {