From bc9b7364b4ed60152d360e074fb686e31db58ca7 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 31 Oct 2014 16:19:39 -0400 Subject: looks like we do need a separate finalize step otherwise inheritance doesn't work, because there's no point at which we can really initialize the backing vtable for the ancestor class methods --- mop/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mop/__init__.py b/mop/__init__.py index c07b12e..b2bf41c 100644 --- a/mop/__init__.py +++ b/mop/__init__.py @@ -265,6 +265,13 @@ def bootstrap(): name="base_object_class", body=lambda self: Object )) + def finalize(self): + for method in self.get_all_methods().values(): + python_install_method(self, method.get_name(), method) + Class.add_method(Method.new( + name="finalize", body=finalize + )) + def isa(self, other): mro = self.metaclass.get_mro() return other in mro @@ -292,9 +299,7 @@ def bootstrap(): python_install_method(Attribute, method.get_name(), method) def add_method(self, method): - name = method.get_name() - self.get_local_methods()[name] = method - python_install_method(self, name, method) + self.get_local_methods()[method.get_name()] = method Class.add_method(Method.new( name="add_method", body=add_method )) -- cgit v1.2.3