aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler.rs2
-rw-r--r--src/lib.rs12
-rw-r--r--src/vm.rs12
3 files changed, 13 insertions, 13 deletions
diff --git a/src/compiler.rs b/src/compiler.rs
index f419527..e8607f7 100644
--- a/src/compiler.rs
+++ b/src/compiler.rs
@@ -1085,7 +1085,7 @@ impl Compiler {
"float" => Ok(Type::Float),
"bool" => Ok(Type::Bool),
"str" => Ok(Type::String),
- x => self.find_blob(x).map(|blob| Type::BlobInstance(blob)).ok_or(()),
+ x => self.find_blob(x).map(|blob| Type::Instance(blob)).ok_or(()),
}
}
_ => Err(()),
diff --git a/src/lib.rs b/src/lib.rs
index ee176e5..c2aee90 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -85,14 +85,14 @@ pub enum Type {
Tuple(Vec<Type>),
Function(Vec<Type>, Box<Type>),
Blob(usize),
- BlobInstance(usize),
+ Instance(usize),
}
impl PartialEq for Type {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Type::Void, Type::Void) => true,
- (Type::BlobInstance(a), Type::BlobInstance(b)) => a == b,
+ (Type::Instance(a), Type::Instance(b)) => a == b,
(Type::Blob(a), Type::Blob(b)) => a == b,
(Type::Int, Type::Int) => true,
(Type::Float, Type::Float) => true,
@@ -111,7 +111,7 @@ impl PartialEq for Type {
impl From<&Value> for Type {
fn from(value: &Value) -> Type {
match value {
- Value::BlobInstance(i, _) => Type::BlobInstance(*i),
+ Value::Instance(i, _) => Type::Instance(*i),
Value::Blob(i) => Type::Blob(*i),
Value::Tuple(v) => {
Type::Tuple(v.iter().map(|x| Type::from(x)).collect())
@@ -137,7 +137,7 @@ impl From<&Type> for Value {
match ty {
Type::Void => Value::Nil,
Type::Blob(i) => Value::Blob(*i),
- Type::BlobInstance(i) => Value::BlobInstance(*i, Rc::new(RefCell::new(Vec::new()))),
+ Type::Instance(i) => Value::Instance(*i, Rc::new(RefCell::new(Vec::new()))),
Type::Tuple(fields) => {
Value::Tuple(Rc::new(fields.iter().map(Value::from).collect()))
}
@@ -164,7 +164,7 @@ impl From<Type> for Value {
pub enum Value {
Ty(Type),
Blob(usize),
- BlobInstance(usize, Rc<RefCell<Vec<Value>>>),
+ Instance(usize, Rc<RefCell<Vec<Value>>>),
Tuple(Rc<Vec<Value>>),
Float(f64),
Int(i64),
@@ -181,7 +181,7 @@ impl Debug for Value {
match self {
Value::Ty(ty) => write!(fmt, "(type {:?})", ty),
Value::Blob(i) => write!(fmt, "(blob {})", i),
- Value::BlobInstance(i, v) => write!(fmt, "(inst {} {:?})", i, v),
+ Value::Instance(i, v) => write!(fmt, "(inst {} {:?})", i, v),
Value::Float(f) => write!(fmt, "(float {})", f),
Value::Int(i) => write!(fmt, "(int {})", i),
Value::Bool(b) => write!(fmt, "(bool {})", b),
diff --git a/src/vm.rs b/src/vm.rs
index c4d72a1..2cef854 100644
--- a/src/vm.rs
+++ b/src/vm.rs
@@ -283,7 +283,7 @@ impl VM {
Op::Get(field) => {
let inst = self.pop();
let field = self.string(field);
- if let Value::BlobInstance(ty, values) = inst {
+ if let Value::Instance(ty, values) = inst {
let slot = self.blobs[ty].fields.get(field).unwrap().0;
self.push(values.borrow()[slot].clone());
} else {
@@ -294,7 +294,7 @@ impl VM {
Op::Set(field) => {
let (inst, value) = self.poppop();
let field = self.string(field);
- if let Value::BlobInstance(ty, values) = inst {
+ if let Value::Instance(ty, values) = inst {
let slot = self.blobs[ty].fields.get(field).unwrap().0;
values.borrow_mut()[slot] = value;
} else {
@@ -402,7 +402,7 @@ impl VM {
}
self.pop();
- self.push(Value::BlobInstance(blob_id, Rc::new(RefCell::new(values))));
+ self.push(Value::Instance(blob_id, Rc::new(RefCell::new(values))));
}
Value::Function(_, block) => {
let inner = block.borrow();
@@ -569,7 +569,7 @@ impl VM {
Op::Get(field) => {
let inst = self.pop();
let field = self.string(field);
- if let Value::BlobInstance(ty, _) = inst {
+ if let Value::Instance(ty, _) = inst {
let value = Value::from(&self.blobs[ty].fields.get(field).unwrap().1);
self.push(value);
} else {
@@ -582,7 +582,7 @@ impl VM {
let (inst, value) = self.poppop();
let field = self.string(field);
- if let Value::BlobInstance(ty, _) = inst {
+ if let Value::Instance(ty, _) = inst {
let ty = &self.blobs[ty].fields.get(field).unwrap().1;
if ty != &Type::from(&value) {
error!(self, ErrorKind::RuntimeTypeError(op, vec![inst]));
@@ -659,7 +659,7 @@ impl VM {
}
self.pop();
- self.push(Value::BlobInstance(blob_id, Rc::new(RefCell::new(values))));
+ self.push(Value::Instance(blob_id, Rc::new(RefCell::new(values))));
}
Value::Function(_, block) => {
let inner = block.borrow();