diff --git a/src/script_opt/Reduce.cc b/src/script_opt/Reduce.cc index f3d0603879..cd4ba8d9ca 100644 --- a/src/script_opt/Reduce.cc +++ b/src/script_opt/Reduce.cc @@ -14,6 +14,20 @@ namespace zeek::detail { +StmtPtr Reducer::Reduce(StmtPtr s) + { + reduction_root = std::move(s); + + try + { + return reduction_root->Reduce(this); + } + catch ( InterpreterException& e ) + { + /* Already reported. */ + return reduction_root; + } + } ExprPtr Reducer::GenTemporaryExpr(const TypePtr& t, ExprPtr rhs) { diff --git a/src/script_opt/Reduce.h b/src/script_opt/Reduce.h index ac62a61c0b..3df88d2913 100644 --- a/src/script_opt/Reduce.h +++ b/src/script_opt/Reduce.h @@ -18,11 +18,7 @@ class Reducer { public: Reducer() { } - StmtPtr Reduce(StmtPtr s) - { - reduction_root = std::move(s); - return reduction_root->Reduce(this); - } + StmtPtr Reduce(StmtPtr s); const DefSetsMgr* GetDefSetsMgr() const { return mgr; } void SetDefSetsMgr(const DefSetsMgr* _mgr) { mgr = _mgr; }