explicitly provide the frame for evaluating a "when" timeout expression

This commit is contained in:
Vern Paxson 2022-01-08 08:24:15 -08:00
parent fa848167bb
commit 98a05538b7
2 changed files with 5 additions and 5 deletions

View file

@ -102,7 +102,7 @@ protected:
Trigger::Trigger(ExprPtr cond, StmtPtr body, StmtPtr timeout_stmts, ExprPtr timeout_expr, Trigger::Trigger(ExprPtr cond, StmtPtr body, StmtPtr timeout_stmts, ExprPtr timeout_expr,
Frame* frame, bool is_return, const Location* location) Frame* frame, bool is_return, const Location* location)
{ {
GetTimeout(timeout_expr); GetTimeout(timeout_expr, frame);
Init(cond, body, timeout_stmts, frame, is_return, location); Init(cond, body, timeout_stmts, frame, is_return, location);
} }
@ -120,12 +120,12 @@ Trigger::Trigger(WhenInfo* wi, const IDSet& _globals, std::vector<ValPtr> _local
local_aggrs = std::move(_local_aggrs); local_aggrs = std::move(_local_aggrs);
have_trigger_elems = true; have_trigger_elems = true;
GetTimeout(wi->TimeoutExpr()); GetTimeout(wi->TimeoutExpr(), f);
Init(wi->Cond(), wi->WhenBody(), wi->TimeoutStmt(), f, wi->IsReturn(), loc); Init(wi->Cond(), wi->WhenBody(), wi->TimeoutStmt(), f, wi->IsReturn(), loc);
} }
void Trigger::GetTimeout(const ExprPtr& timeout_expr) void Trigger::GetTimeout(const ExprPtr& timeout_expr, Frame* f)
{ {
timeout_value = -1.0; timeout_value = -1.0;
@ -135,7 +135,7 @@ void Trigger::GetTimeout(const ExprPtr& timeout_expr)
try try
{ {
timeout_val = timeout_expr->Eval(frame); timeout_val = timeout_expr->Eval(f);
} }
catch ( InterpreterException& ) catch ( InterpreterException& )
{ /* Already reported */ { /* Already reported */

View file

@ -112,7 +112,7 @@ public:
private: private:
friend class TriggerTimer; friend class TriggerTimer;
void GetTimeout(const ExprPtr& timeout_expr); void GetTimeout(const ExprPtr& timeout_expr, Frame* f);
void Init(ExprPtr cond, StmtPtr body, StmtPtr timeout_stmts, Frame* frame, bool is_return, void Init(ExprPtr cond, StmtPtr body, StmtPtr timeout_stmts, Frame* frame, bool is_return,
const Location* location); const Location* location);