X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fmethods.lisp;fp=src%2Fmethods.lisp;h=ec9bba78d4466ab56a558fcd2a411ef08bd37655;hb=76073a5348f43eda6e5d4256377c7bb85eacfdfa;hp=7cdbd9880e2700f8212f6dbda11a98921277629d;hpb=346a578e2303a8c58192925d192fed44853b4988;p=cl-mock.git diff --git a/src/methods.lisp b/src/methods.lisp index 7cdbd98..ec9bba7 100644 --- a/src/methods.lisp +++ b/src/methods.lisp @@ -55,21 +55,20 @@ (defmacro progm* (methods values &body body) `(call-with-method-bindings* ,methods ,values (lambda () ,@body))) +(defun classify (specializer) + (if (classp specializer) + specializer + (find-class specializer))) + (defun call-with-method-bindings (methods values function &optional previous) (let ((methods (mapcar (lambda (method) (destructuring-bind (generic-function qualifiers specializers) method (list - (if (functionp generic-function) - generic-function - (fdefinition generic-function)) + (ensure-function generic-function) qualifiers - (mapcar (lambda (specializer) - (if (classp specializer) - specializer - (find-class specializer))) - specializers)))) + (mapcar #'classify specializers)))) methods))) (call-with-method-bindings* methods values function (or previous (find-methods methods)))))