aboutsummaryrefslogtreecommitdiffstats
path: root/bytecode/src/data.rs
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-08-27 19:30:16 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-08-27 19:30:16 -0700
commit59ca512ec8f099a7d4c8aa4392f939d1aa5aee5d (patch)
tree870b95b19f19c035df62171fdcbaa1ae041e76ae /bytecode/src/data.rs
parent55a9ceb549911e598be213bdb755272e0f9c4a5c (diff)
downloadchromatopelma-59ca512ec8f099a7d4c8aa4392f939d1aa5aee5d.tar.zst
Implement multiple return values.
Diffstat (limited to 'bytecode/src/data.rs')
-rw-r--r--bytecode/src/data.rs7
1 files changed, 5 insertions, 2 deletions
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<Pointer, String> {
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<i64, String> {
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);
}