From 5dc021f9537a7d6dda991d6126fd4b913c9a5594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 29 Mar 2024 15:10:06 +0100 Subject: [PATCH] make yield look more like the other instructions syntactically --- ic10emu/src/interpreter.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ic10emu/src/interpreter.rs b/ic10emu/src/interpreter.rs index 910a257..1a8de6f 100644 --- a/ic10emu/src/interpreter.rs +++ b/ic10emu/src/interpreter.rs @@ -444,14 +444,13 @@ impl IC { } oprs => Err(ICError::mismatch_operands(oprs.len(), 1)), }, // TODO - Yield => { - if !operands.is_empty() { - Err(ICError::too_many_operands(operands.len(), 0)) - } else { + Yield => match &operands[..] { + [] => { self.state = ICState::Yield; Ok(()) } - } + oprs => Err(ICError::mismatch_operands(oprs.len(), 0)), + }, Define => match &operands[..] { [name, number] => { let &Operand::Identifier(ident) = &name else {