This commit is contained in:
2026-03-24 13:40:37 +00:00
parent 790629fee7
commit 8d80685654
5 changed files with 6 additions and 61 deletions
@@ -102,7 +102,7 @@ impl From<ProgramImage> for BytecodeModule {
Value::String(v) => ConstantPoolEntry::String(v.clone()),
Value::Int32(v) => ConstantPoolEntry::Int32(*v),
Value::Bounded(v) => ConstantPoolEntry::Int32(*v as i32),
Value::Gate(_) => ConstantPoolEntry::Null,
Value::Handle(_) => ConstantPoolEntry::Null,
})
.collect();
@@ -23,7 +23,7 @@ pub enum Value {
/// Bounded 16-bit-ish integer.
Bounded(u32),
/// A pointer to an object on the heap.
Gate(usize),
Handle(usize),
/// Represents the absence of a value (equivalent to `null` or `undefined`).
Null,
}
@@ -43,7 +43,7 @@ impl PartialEq for Value {
(Value::Boolean(a), Value::Boolean(b)) => a == b,
(Value::String(a), Value::String(b)) => a == b,
(Value::Bounded(a), Value::Bounded(b)) => a == b,
(Value::Gate(a), Value::Gate(b)) => a == b,
(Value::Handle(a), Value::Handle(b)) => a == b,
(Value::Null, Value::Null) => true,
_ => false,
}
@@ -99,7 +99,7 @@ impl Value {
Value::Bounded(b) => format!("{}b", b),
Value::Boolean(b) => b.to_string(),
Value::String(s) => s.clone(),
Value::Gate(r) => format!("[Gate {}]", r),
Value::Handle(r) => format!("[Handle {}]", r),
Value::Null => "null".to_string(),
}
}