From e6e75a38a8310dc759ebb64b10c2822dd2705c39 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Tue, 5 Feb 2008 17:39:08 +0100 Subject: Reflect the Objective-C class hierarchy in the metaclass hierarchy as well. darcs-hash:cf65597e69517e41fb3e7f92db71b086ca4508b9 --- Lisp/libobjcl.lisp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'Lisp/libobjcl.lisp') diff --git a/Lisp/libobjcl.lisp b/Lisp/libobjcl.lisp index b281cff..f686c9d 100644 --- a/Lisp/libobjcl.lisp +++ b/Lisp/libobjcl.lisp @@ -282,12 +282,26 @@ conventional case for namespace identifiers in Objective-C." (let ((class-ptr (%objcl-find-meta-class class-name-string))) (if (objc-pointer-null class-ptr) nil - (let ((class-name (objc-meta-class-name->symbol class-name-string))) + (let* ((class-name (objc-meta-class-name->symbol class-name-string)) + ;; We first determine the superclass of the class that + ;; this metaclass is the metaclass of, because we cannot + ;; determine a metaclass' superclass directly. + (non-meta-superclass (objcl-class-superclass/pointer + (%objcl-find-class class-name-string))) + ;; If such a non-meta-superclass is found, we look for a + ;; metaclass with the same name and take that as our + ;; superclass. Otherwise, OBJECTIVE-C-CLASS should be + ;; quite the most correct choice. + (superclass (if non-meta-superclass + (find-objc-meta-class + (%objcl-class-name + (pointer-to non-meta-superclass))) + (find-class 'objective-c-class)))) (or (find-class class-name nil) (c2mop:ensure-class class-name :metaclass 'objective-c-meta-class :pointer class-ptr - :direct-superclasses '(objective-c-class))))))) + :direct-superclasses (list superclass))))))) (defun objc-pointer-null (pointer) -- cgit v1.2.3