diff --git a/src/protocol/eval/executor.rs b/src/protocol/eval/executor.rs index 3b16522574521e6ec3bdb70b57ee34b22073a949..f1d6a665dc146700bdb0f38d1bd752a35c97946f 100644 --- a/src/protocol/eval/executor.rs +++ b/src/protocol/eval/executor.rs @@ -192,18 +192,22 @@ impl Frame { type EvalResult = Result; +#[derive(Debug)] pub enum EvalContinuation { + // Returned in both sync and non-sync modes Stepping, - Inconsistent, - Terminal, - SyncBlockStart, + // Returned only in sync mode + BranchInconsistent, SyncBlockEnd, - NewComponent(DefinitionId, i32, ValueGroup), - NewChannel, NewFork, BlockFires(PortId), BlockGet(PortId), - Put(PortId, Value), + Put(PortId, ValueGroup), + // Returned only in non-sync mode + ComponentTerminated, + SyncBlockStart, + NewComponent(DefinitionId, i32, ValueGroup), + NewChannel, } // Note: cloning is fine, methinks. cloning all values and the heap regions then @@ -286,7 +290,7 @@ impl Prompt { if heap[cur_frame.definition].is_function() { todo!("End of function without return, return an evaluation error"); } - return Ok(EvalContinuation::Terminal); + return Ok(EvalContinuation::ComponentTerminated); } debug_log!("Taking step in '{}'", heap[cur_frame.definition].identifier().value.as_str()); @@ -623,7 +627,8 @@ impl Prompt { cur_frame.expr_values.push_front(msg_value); cur_frame.expr_values.push_front(port_value); cur_frame.expr_stack.push_back(ExprInstruction::EvalExpr(expr_id)); - return Ok(EvalContinuation::Put(port_id, deref_msg_value)); + let value_group = ValueGroup::from_store(&self.store, &[deref_msg_value]); + return Ok(EvalContinuation::Put(port_id, value_group)); } }, Method::Fires => { @@ -692,7 +697,7 @@ impl Prompt { let value = cur_frame.expr_values.pop_front().unwrap(); let value = self.store.maybe_read_ref(&value).clone(); if !value.as_bool() { - return Ok(EvalContinuation::Inconsistent) + return Ok(EvalContinuation::BranchInconsistent) } }, Method::Print => { @@ -942,7 +947,7 @@ impl Prompt { debug_assert!(prev_stack_idx == -1); debug_assert!(self.store.stack.len() == 0); self.store.stack.push(return_value); - return Ok(EvalContinuation::Terminal); + return Ok(EvalContinuation::ComponentTerminated); } debug_assert!(prev_stack_idx >= 0);