1
0
This commit is contained in:
Jeff 2024-11-07 00:49:36 -05:00
parent 3a6c05a79c
commit f54d2d0d22
3 changed files with 25 additions and 17 deletions

View File

@ -353,7 +353,7 @@ impl<'a> Disassembler<'a> {
.indent(self.indent + 1)
.disassemble();
self.push_details(&function_disassembly);
self.output.push_str(&function_disassembly);
}
}

View File

@ -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<u8> for NativeFunction {

View File

@ -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),