diff --git a/dust-lang/src/disassembler.rs b/dust-lang/src/disassembler.rs index 0a7be92..9c17e1d 100644 --- a/dust-lang/src/disassembler.rs +++ b/dust-lang/src/disassembler.rs @@ -353,7 +353,7 @@ impl<'a> Disassembler<'a> { .indent(self.indent + 1) .disassemble(); - self.push_details(&function_disassembly); + self.output.push_str(&function_disassembly); } } diff --git a/dust-lang/src/native_function.rs b/dust-lang/src/native_function.rs index 80d5052..4cab885 100644 --- a/dust-lang/src/native_function.rs +++ b/dust-lang/src/native_function.rs @@ -52,6 +52,14 @@ macro_rules! define_native_function { )* } } + + pub fn returns_value(&self) -> bool { + match self { + $( + NativeFunction::$name => $type.return_type.is_some(), + )* + } + } } impl From for NativeFunction { diff --git a/dust-lang/src/value.rs b/dust-lang/src/value.rs index b39dc83..b6d2db2 100644 --- a/dust-lang/src/value.rs +++ b/dust-lang/src/value.rs @@ -344,6 +344,22 @@ impl Display for Value { } } +/// Value representation that can be resolved to a concrete value by the VM. +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] +pub enum AbstractValue { + List { start: u8, end: u8, item_type: Type }, +} + +impl Display for AbstractValue { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + match self { + AbstractValue::List { start, end, .. } => { + write!(f, "List [R{}..=R{}]", start, end) + } + } + } +} + #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub enum ConcreteValue { Boolean(bool), @@ -714,22 +730,6 @@ impl Ord for RangeValue { } } -/// Value representation that can be resolved to a concrete value by the VM. -#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] -pub enum AbstractValue { - List { start: u8, end: u8, item_type: Type }, -} - -impl Display for AbstractValue { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - match self { - AbstractValue::List { start, end, .. } => { - write!(f, "List [R{}..=R{}]", start, end) - } - } - } -} - #[derive(Clone, Debug, PartialEq)] pub enum ValueError { CannotAdd(Value, Value),