Commit 9d940c66 authored by Stefan Monnier's avatar Stefan Monnier

* lisp/emacs-lisp/cl-generic.el (cl--generic-build-combined-method):

Return the value of the primary rather than the after method.
parent 78e6ccc4
......@@ -38,6 +38,9 @@
2015-01-15 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/cl-generic.el (cl--generic-build-combined-method):
Return the value of the primary rather than the after method.
* emacs-lisp/eieio-core.el: Provide support for cl-generic.
(eieio--generic-tagcode): New function.
(cl-generic-tagcode-function): Use it.
......
......@@ -411,9 +411,10 @@ for all those different tags in the method-cache.")
(setq fun (lambda (&rest args)
(dolist (bf before)
(apply bf args))
(apply next args)
(dolist (af after)
(apply af args))))))
(prog1
(apply next args)
(dolist (af after)
(apply af args)))))))
(cl--generic-nest fun (alist-get :around mets-by-qual))))))))
(defun cl--generic-cache-miss (generic dispatch-arg dispatches-left tags)
......
......@@ -129,5 +129,18 @@
(cons "x&y-int" (cl-call-next-method)))
(should (equal (cl--generic-1 1 2) '("x&y-int" "y-int" "x-int" 1 2))))
(ert-deftest cl-generic-test-7-after/before ()
(let ((log ()))
(cl-defgeneric cl--generic-1 (x y))
(cl-defmethod cl--generic-1 ((_x t) y) (cons y log))
(cl-defmethod cl--generic-1 ((_x (eql 4)) _y)
(cons "quatre" (cl-call-next-method)))
(cl-defmethod cl--generic-1 :after (x _y)
(push (list :after x) log))
(cl-defmethod cl--generic-1 :before (x _y)
(push (list :before x) log))
(should (equal (cl--generic-1 4 6) '("quatre" 6 (:before 4))))
(should (equal log '((:after 4) (:before 4))))))
(provide 'cl-generic-tests)
;;; cl-generic-tests.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment