From 59ca512ec8f099a7d4c8aa4392f939d1aa5aee5d Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sat, 27 Aug 2022 19:30:16 -0700 Subject: Implement multiple return values. --- bytecode/src/data.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bytecode/src/data.rs') diff --git a/bytecode/src/data.rs b/bytecode/src/data.rs index e14eaa9..4774f2a 100644 --- a/bytecode/src/data.rs +++ b/bytecode/src/data.rs @@ -52,7 +52,10 @@ impl Value { pub fn to_pointer(self) -> Result { let Value(stack_representation) = self; if !self.is_pointer() { - return Err(format!("value {:x} is not a pointer", stack_representation)); + return Err(format!( + "value 0x{:x} is not a pointer", + stack_representation + )); } return Ok(Pointer(usize::try_from(stack_representation).unwrap())); } @@ -69,7 +72,7 @@ impl Value { pub fn to_int(self) -> Result { let Value(stack_representation) = self; if !self.is_int() { - return Err(format!("value {:x} is not an int", stack_representation)); + return Err(format!("value 0x{:x} is not an int", stack_representation)); } return Ok(stack_representation as i64 >> 1); } -- cgit v1.3.1