Temporarily remove Value::ObjPtr because we aren't using those yet
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -62,14 +62,14 @@ impl QuoteTable {
|
||||
// Value
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Value {
|
||||
Array(Vec<Value>),
|
||||
Float(Float),
|
||||
Int(Int),
|
||||
Str(Str),
|
||||
Quote(Quote),
|
||||
ObjPtr(ObjPtr),
|
||||
//ObjPtr(ObjPtr),
|
||||
BuiltinFn(BuiltinFn),
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ impl Value {
|
||||
Int(_) => "int",
|
||||
Str(_) => "str",
|
||||
Quote(_) => "quote",
|
||||
ObjPtr(_) => "object",
|
||||
//ObjPtr(_) => "object",
|
||||
BuiltinFn(_) => "builtin function",
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ impl Value {
|
||||
Int(i) => *i != 0,
|
||||
Str(s) => s.len() > 0,
|
||||
Quote(_) => true,
|
||||
ObjPtr(_) => true,
|
||||
//ObjPtr(_) => true,
|
||||
BuiltinFn(_) => true,
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ impl Display for Value {
|
||||
Int(i) => write!(fmt, "{}", i),
|
||||
Str(s) => write!(fmt, "{}", s),
|
||||
Quote(q) => write!(fmt, "[quoted value #{}]", q.index()),
|
||||
ObjPtr(o) => write!(fmt, "[object #{}]", o.slot()),
|
||||
//ObjPtr(o) => write!(fmt, "[object #{}]", o.slot()),
|
||||
BuiltinFn(b) => write!(fmt, "[{:?}]", b),
|
||||
}
|
||||
}
|
||||
@@ -141,6 +141,12 @@ pub struct BuiltinFn {
|
||||
fun: Rc<BuiltinFnPtr>,
|
||||
}
|
||||
|
||||
impl PartialEq for BuiltinFn {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
(&self.fun as *const _ as usize) == (&other.fun as *const _ as usize)
|
||||
}
|
||||
}
|
||||
|
||||
impl BuiltinFn {
|
||||
pub fn new(name: String, fun: Rc<BuiltinFnPtr>) -> Self {
|
||||
BuiltinFn {
|
||||
|
||||
Reference in New Issue
Block a user