Clean up
This commit is contained in:
parent
3a6c05a79c
commit
f54d2d0d22
@ -353,7 +353,7 @@ impl<'a> Disassembler<'a> {
|
||||
.indent(self.indent + 1)
|
||||
.disassemble();
|
||||
|
||||
self.push_details(&function_disassembly);
|
||||
self.output.push_str(&function_disassembly);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user