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
|
// Value
|
||||||
// /////////////////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Value {
|
pub enum Value {
|
||||||
Array(Vec<Value>),
|
Array(Vec<Value>),
|
||||||
Float(Float),
|
Float(Float),
|
||||||
Int(Int),
|
Int(Int),
|
||||||
Str(Str),
|
Str(Str),
|
||||||
Quote(Quote),
|
Quote(Quote),
|
||||||
ObjPtr(ObjPtr),
|
//ObjPtr(ObjPtr),
|
||||||
BuiltinFn(BuiltinFn),
|
BuiltinFn(BuiltinFn),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ impl Value {
|
|||||||
Int(_) => "int",
|
Int(_) => "int",
|
||||||
Str(_) => "str",
|
Str(_) => "str",
|
||||||
Quote(_) => "quote",
|
Quote(_) => "quote",
|
||||||
ObjPtr(_) => "object",
|
//ObjPtr(_) => "object",
|
||||||
BuiltinFn(_) => "builtin function",
|
BuiltinFn(_) => "builtin function",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ impl Value {
|
|||||||
Int(i) => *i != 0,
|
Int(i) => *i != 0,
|
||||||
Str(s) => s.len() > 0,
|
Str(s) => s.len() > 0,
|
||||||
Quote(_) => true,
|
Quote(_) => true,
|
||||||
ObjPtr(_) => true,
|
//ObjPtr(_) => true,
|
||||||
BuiltinFn(_) => true,
|
BuiltinFn(_) => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ impl Display for Value {
|
|||||||
Int(i) => write!(fmt, "{}", i),
|
Int(i) => write!(fmt, "{}", i),
|
||||||
Str(s) => write!(fmt, "{}", s),
|
Str(s) => write!(fmt, "{}", s),
|
||||||
Quote(q) => write!(fmt, "[quoted value #{}]", q.index()),
|
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),
|
BuiltinFn(b) => write!(fmt, "[{:?}]", b),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,6 +141,12 @@ pub struct BuiltinFn {
|
|||||||
fun: Rc<BuiltinFnPtr>,
|
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 {
|
impl BuiltinFn {
|
||||||
pub fn new(name: String, fun: Rc<BuiltinFnPtr>) -> Self {
|
pub fn new(name: String, fun: Rc<BuiltinFnPtr>) -> Self {
|
||||||
BuiltinFn {
|
BuiltinFn {
|
||||||
|
|||||||
Reference in New Issue
Block a user