;; Author: Eric M. Ludlam <zappo@gnu.org>
;; Keywords: OO, lisp
+;; Package: eieio
;; This file is part of GNU Emacs.
(defgeneric ,method ,args)
(eieio--defmethod ',method ',key ',class #',code))))
-(add-function :before-until cl-generic-tagcode-function
- #'eieio--generic-static-tagcode)
-(defun eieio--generic-static-tagcode (type name)
- (and (eq 'eieio--static (car-safe type))
- `(40 . (cond
- ((symbolp ,name) (eieio--class-v ,name))
- ((vectorp ,name) (aref ,name 0))))))
-
-(add-function :around cl-generic-tag-types-function
- #'eieio--generic-static-tag-types)
-(defun eieio--generic-static-tag-types (orig-fun tag)
- (cond
- ((or (eieio--class-p tag)
- (and (symbolp tag) (boundp tag) (eieio--class-p (symbol-value tag))))
- (let ((superclasses (funcall orig-fun tag))
- (types ()))
- ;; Interleave: (subclass <foo>) (eieio--static <foo>) <subclass <bar>) ..
+(defun eieio--generic-static-symbol-specializers (tag &rest _)
+ (cl-assert (or (null tag) (eieio--class-p tag)))
+ (when (eieio--class-p tag)
+ (let ((superclasses (eieio--generic-subclass-specializers tag))
+ (specializers ()))
(dolist (superclass superclasses)
- (push superclass types)
- (push `(eieio--static
- ,(if (consp superclass) (cadr superclass) superclass))
- types))
- (nreverse types)))
- (t (funcall orig-fun tag))))
+ (push superclass specializers)
+ (push `(eieio--static ,(cadr superclass)) specializers))
+ (nreverse specializers))))
+
+(cl-generic-define-generalizer eieio--generic-static-symbol-generalizer
+ ;; Give it a slightly higher priority than `subclass' so that the
+ ;; interleaved list comes before subclass's non-interleaved list.
+ 61 (lambda (name &rest _) `(and (symbolp ,name) (cl--find-class ,name)))
+ #'eieio--generic-static-symbol-specializers)
+(cl-generic-define-generalizer eieio--generic-static-object-generalizer
+ ;; Give it a slightly higher priority than `class' so that the
+ ;; interleaved list comes before the class's non-interleaved list.
+ 51 #'cl--generic-struct-tag
+ (lambda (tag &rest _)
+ (and (symbolp tag) (boundp tag) (setq tag (symbol-value tag))
+ (eieio--class-p tag)
+ (let ((superclasses (eieio--class-precedence-list tag))
+ (specializers ()))
+ (dolist (superclass superclasses)
+ (setq superclass (eieio--class-name superclass))
+ (push superclass specializers)
+ (push `(eieio--static ,superclass) specializers))
+ (nreverse specializers)))))
+
+(cl-defmethod cl-generic-generalizers ((_specializer (head eieio--static)))
+ (list eieio--generic-static-symbol-generalizer
+ eieio--generic-static-object-generalizer))
;;;###autoload
(defun eieio--defgeneric-init-form (method doc-string)
(args (help-function-arglist code 'preserve-names))
(doc-only (if docstring
(let ((split (help-split-fundoc docstring nil)))
- (if split (cdr split) docstring))))
- (new-docstring (help-add-fundoc-usage doc-only
- (cons 'cl-cnm args))))
- ;; FIXME: ¡Add new-docstring to those closures!
+ (if split (cdr split) docstring)))))
(lambda (cnm &rest args)
+ (:documentation
+ (help-add-fundoc-usage doc-only (cons 'cl-cnm args)))
(cl-letf (((symbol-function 'call-next-method) cnm)
((symbol-function 'next-method-p)
(lambda () (cl--generic-isnot-nnm-p cnm))))
;; Local Variables:
-;; generated-autoload-file: "eieio-core.el"
+;; generated-autoload-file: "eieio-loaddefs.el"
;; End:
(provide 'eieio-compat)