gracefully deal with "eval" exceptions that occur during AST reduction

This commit is contained in:
Vern Paxson 2021-05-30 17:48:14 -07:00
parent 9a429808ab
commit b7c9940221
2 changed files with 15 additions and 5 deletions

View file

@ -14,6 +14,20 @@
namespace zeek::detail { 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) ExprPtr Reducer::GenTemporaryExpr(const TypePtr& t, ExprPtr rhs)
{ {

View file

@ -18,11 +18,7 @@ class Reducer {
public: public:
Reducer() { } Reducer() { }
StmtPtr Reduce(StmtPtr s) StmtPtr Reduce(StmtPtr s);
{
reduction_root = std::move(s);
return reduction_root->Reduce(this);
}
const DefSetsMgr* GetDefSetsMgr() const { return mgr; } const DefSetsMgr* GetDefSetsMgr() const { return mgr; }
void SetDefSetsMgr(const DefSetsMgr* _mgr) { mgr = _mgr; } void SetDefSetsMgr(const DefSetsMgr* _mgr) { mgr = _mgr; }