Ticket #239: defgeneric-patch.patch

File defgeneric-patch.patch, 2.1 KB (added by rschlatte, 12 years ago)

defgeneric generic-function-class warning patch

  • src/org/armedbear/lisp/clos.lisp

    Changes in HEAD
    	Modified   src/org/armedbear/lisp/clos.lisp
    diff --git a/src/org/armedbear/lisp/clos.lisp b/src/org/armedbear/lisp/clos.lisp
    index 5d46bc1..2991acb 100644
    a b compare the method combination name to the symbol 'standard.") 
    16051605;;; defgeneric
    16061606
    16071607(defmacro defgeneric (function-name lambda-list
    1608                                     &rest options-and-method-descriptions)
     1608                                    &rest options-and-method-descriptions
     1609                                    &environment env)
    16091610  (let ((options ())
    16101611        (methods ())
    16111612        (declarations ())
    1612         (documentation nil))
     1613        (documentation nil)
     1614        (generic-function-class nil))
    16131615    (dolist (item options-and-method-descriptions)
    16141616      (case (car item)
    16151617        (declare
    compare the method combination name to the symbol 'standard.") 
    16261628          `(push (defmethod ,function-name ,@(cdr item))
    16271629                 (generic-function-initial-methods (fdefinition ',function-name)))
    16281630          methods))
     1631        (:generic-function-class
     1632         (when generic-function-class
     1633           (error 'program-error
     1634                  :format-control "Generic function class was specified twice for generic function ~S."
     1635                  :format-arguments (list function-name)))
     1636         (setf generic-function-class (second item))
     1637         (push item options))
    16291638        (t
    16301639         (push item options))))
    16311640    (when declarations (push (list :declarations declarations) options))
    16321641    (setf options (nreverse options)
    16331642          methods (nreverse methods))
     1643    (when generic-function-class
     1644      (let ((class (find-class generic-function-class t env)))
     1645        (unless (typep (class-of class) 'funcallable-standard-class)
     1646          (warn "Supplied generic function class ~S ~_for generic function ~S ~_is not of metaclass FUNCALLABLE-STANDARD-CLASS"
     1647                generic-function-class function-name))))
    16341648    ;;; Since DEFGENERIC currently shares its argument parsing with
    16351649    ;;; DEFMETHOD, we perform this check here.
    16361650    (when (find '&aux lambda-list)