Typesystem global instance churn, again
I don't know if I'm ever going to get this right. It's a massive pain having to pass around the base "Method" type everywhere. It really makes a lot more sense to have it already defined someplace statically available. It makes doing like getting an attribute or vtable entry a lot more ergonomic. Previously we'd have to pass in the Method type every time, which was silly. Now we can just let the MethodInst::instantiate() function query it directly. Like, this is 100000% better. Also, I got rid of get_attr_lazy in favor of get_vtable_attr. I think that I want to unify get_attr and get_vtable_attr, but that would require a GC pointer to the "self" object on every object that you create. That's a bit iffy. But for now, things are feeling a little better and all the tests are passing, so that's good at least. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -125,7 +125,7 @@ impl Obj for BuiltinFunctionInst {
|
||||
}
|
||||
}
|
||||
|
||||
impl_base_obj!();
|
||||
impl_base_obj!(BuiltinFunction);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -216,7 +216,7 @@ impl Obj for UserFunctionInst {
|
||||
}
|
||||
}
|
||||
|
||||
impl_base_obj!();
|
||||
impl_base_obj!(UserFunction);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -249,9 +249,9 @@ impl MethodInst {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create(ty: ObjP, self_binding: ObjP, function: ObjP) -> ObjP {
|
||||
pub fn create(self_binding: ObjP, function: ObjP) -> ObjP {
|
||||
let ptr = make_ptr(Self::new(self_binding, function));
|
||||
ptr.borrow_mut().instantiate(ty.clone());
|
||||
ptr.borrow_mut().instantiate();
|
||||
ptr
|
||||
}
|
||||
|
||||
@@ -294,5 +294,5 @@ impl Obj for MethodInst {
|
||||
}
|
||||
}
|
||||
|
||||
impl_base_obj!();
|
||||
impl_base_obj!(Method);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user