* lisp/emacs-lisp/cl-generic.el (cl--generic-method): New struct.

(cl--generic): The method-table is now a (list-of cl--generic-method).
(cl--generic-member-method): New function.
(cl-generic-define-method): Use it.
(cl--generic-build-combined-method, cl--generic-cache-miss):
Adapt to new method-table.
(cl--generic-no-next-method-function): Add `method' argument.
(cl-generic-call-method): Adapt to new method representation.
(cl--generic-cnm-sample, cl--generic-nnm-sample): Adjust.
(cl-find-method, cl-method-qualifiers): New functions.
(cl--generic-method-info): Adapt to new method representation.
Return a string for the qualifiers.
(cl--generic-describe):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-class): Adjust accordingly.
(eieio-all-generic-functions, eieio-method-documentation):
Adjust to new method representation.

* lisp/emacs-lisp/eieio-compat.el (eieio--defmethod): Use cl-find-method.

* test/automated/cl-generic-tests.el: Try and make sure cl-lib is not
required at run-time.
This commit is contained in:
Stefan Monnier 2015-01-26 11:43:06 -05:00
parent 4cdde9196f
commit a9a3d429e6
6 changed files with 133 additions and 83 deletions

View file

@ -203,11 +203,10 @@ Summary:
;; or :after, make sure there's a matching dummy primary.
(when (and (memq kind '(:before :after))
;; FIXME: Use `cl-find-method'?
(not (assoc (cons (mapcar (lambda (arg)
(if (consp arg) (nth 1 arg) t))
specializers)
nil)
(cl--generic-method-table (cl--generic method)))))
(not (cl-find-method method ()
(mapcar (lambda (arg)
(if (consp arg) (nth 1 arg) t))
specializers))))
(cl-generic-define-method method () specializers t
(lambda (cnm &rest args)
(if (cl--generic-isnot-nnm-p cnm)