X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fdefcombin.lisp;h=0b2111edf0148512b895613ce3fca8f50fd56b7f;hb=56f96e77ade913d6363a3068c94e60f44ae9b3e7;hp=0ca152104e8ca37f7e6494731843d30f81fc8e26;hpb=08307967c71c580058a503d46aa087cfefcf8c69;p=sbcl.git diff --git a/src/pcl/defcombin.lisp b/src/pcl/defcombin.lisp index 0ca1521..0b2111e 100644 --- a/src/pcl/defcombin.lisp +++ b/src/pcl/defcombin.lisp @@ -124,6 +124,7 @@ (let ((type (method-combination-type combin)) (operator (short-combination-operator combin)) (ioa (short-combination-identity-with-one-argument combin)) + (order (car (method-combination-options combin))) (around ()) (primary ())) (dolist (m applicable-methods) @@ -147,8 +148,11 @@ (push m primary)) (t (lose m "has an illegal qualifier")))))) - (setq around (nreverse around) - primary (nreverse primary)) + (setq around (nreverse around)) + (ecase order + (:most-specific-last) ; nothing to be done, already in correct order + (:most-specific-first + (setq primary (nreverse primary)))) (let ((main-method (if (and (null (cdr primary)) (not (null ioa))) @@ -174,15 +178,15 @@ (lambda-list (caddr form)) (method-group-specifiers (cadddr form)) (body (cddddr form)) - (arguments-option ()) + (args-option ()) (gf-var nil)) (when (and (consp (car body)) (eq (caar body) :arguments)) - (setq arguments-option (cdr (pop body)))) + (setq args-option (cdr (pop body)))) (when (and (consp (car body)) (eq (caar body) :generic-function)) (setq gf-var (cadr (pop body)))) (multiple-value-bind (documentation function) (make-long-method-combination-function - type lambda-list method-group-specifiers arguments-option gf-var + type lambda-list method-group-specifiers args-option gf-var body) `(load-long-defcombin ',type ',documentation #',function)))) @@ -204,9 +208,10 @@ (declare (ignore nms cm-args)) (apply (lambda (generic-function type options) - (declare (ignore generic-function options)) + (declare (ignore generic-function)) (make-instance 'long-method-combination :type type + :options options :documentation doc)) args)) :definition-source `((define-method-combination ,type) @@ -225,11 +230,11 @@ applicable-methods)) (defun make-long-method-combination-function - (type ll method-group-specifiers arguments-option gf-var body) - ;;(declare (values documentation function)) + (type ll method-group-specifiers args-option gf-var body) (declare (ignore type)) - (multiple-value-bind (documentation declarations real-body) - (extract-declarations body) + (multiple-value-bind (real-body declarations documentation) + ;; (Note that PARSE-BODY ignores its second arg ENVIRONMENT.) + (parse-body body nil) (let ((wrapped-body (wrap-method-group-specifier-bindings method-group-specifiers @@ -238,9 +243,8 @@ (when gf-var (push `(,gf-var .generic-function.) (cadr wrapped-body))) - (when arguments-option - (setq wrapped-body (deal-with-arguments-option wrapped-body - arguments-option))) + (when args-option + (setq wrapped-body (deal-with-args-option wrapped-body args-option))) (when ll (setq wrapped-body @@ -365,16 +369,16 @@ ;;; ;;; At compute-effective-method time, the symbols in the :arguments ;;; option are bound to the symbols in the intercept lambda list. -(defun deal-with-arguments-option (wrapped-body arguments-option) +(defun deal-with-args-option (wrapped-body args-option) (let* ((intercept-lambda-list (let (collect) - (dolist (arg arguments-option) + (dolist (arg args-option) (if (memq arg lambda-list-keywords) (push arg collect) (push (gensym) collect))) (nreverse collect))) (intercept-rebindings - (loop for arg in arguments-option + (loop for arg in args-option for int in intercept-lambda-list unless (memq arg lambda-list-keywords) collect `(,arg ',int))))