diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-05 17:39:08 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-02-05 17:39:08 +0100 |
commit | e6e75a38a8310dc759ebb64b10c2822dd2705c39 (patch) | |
tree | 6e6852aeeca3bc25772227043dbeda0da34ae1c9 | |
parent | 8db7975b6882a34ba2ac67c8cc2d6765f8cac8e7 (diff) |
Reflect the Objective-C class hierarchy in the metaclass hierarchy as well.
darcs-hash:cf65597e69517e41fb3e7f92db71b086ca4508b9
-rw-r--r-- | Lisp/libobjcl.lisp | 18 |
1 files changed, 16 insertions, 2 deletions
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) |