Ignore:
Timestamp:
10/29/20 16:55:03 (3 years ago)
Author:
Mark Evenson
Message:

Tidy call-next-method flets with macrology

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/clos.lisp

    r15427 r15459  
    27402740(defvar *next-method-p-p*)
    27412741
     2742;;; FIXME this doesn't work for macroized references
    27422743(defun walk-form (form)
    27432744  (cond ((atom form)
     
    27492750         (walk-form (%car form))
    27502751         (walk-form (%cdr form)))))
     2752
     2753(defmacro flet-call-next-method (args next-emfun &body body)
     2754  `(flet ((call-next-method (&rest cnm-args)
     2755            (if (null ,next-emfun)
     2756                (error "No next method for generic function.")
     2757                (funcall ,next-emfun (or cnm-args ,args))))
     2758          (next-method-p ()
     2759            (not (null ,next-emfun))))
     2760     (declare (ignorable (function call-next-method)
     2761                         (function next-method-p)))
     2762     ,@body))
    27512763
    27522764(defun compute-method-function (lambda-expression)
     
    27682780                     (declare (ignorable ,(%car lambda-list)))
    27692781                     ,@declarations
    2770                      (flet ((call-next-method (&rest cnm-args)
    2771                               (if (null next-emfun)
    2772                                   (error "No next method for generic function.")
    2773                                   (funcall next-emfun (or cnm-args args))))
    2774                             (next-method-p ()
    2775                               (not (null next-emfun))))
    2776                        (declare (ignorable (function call-next-method)
    2777                                            (function next-method-p)))
     2782                     (flet-call-next-method args next-emfun
    27782783                       ,@body))))
    2779                      
    27802784               (2
    27812785                `(lambda (args next-emfun)
     
    27852789                                         ,(%cadr lambda-list)))
    27862790                     ,@declarations
    2787                      (flet ((call-next-method (&rest cnm-args)
    2788                               (if (null next-emfun)
    2789                                   (error "No next method for generic function.")
    2790                                   (funcall next-emfun (or cnm-args args))))
    2791                             (next-method-p ()
    2792                               (not (null next-emfun))))
    2793                        (declare (ignorable (function call-next-method)
    2794                                            (function next-method-p)))
    2795 
     2791                     (flet-call-next-method args next-emfun
    27962792                       ,@body))))
    27972793               (3
     
    28042800                                         ,(%caddr lambda-list)))
    28052801                     ,@declarations
    2806                      (flet ((call-next-method (&rest cnm-args)
    2807                               (if (null next-emfun)
    2808                                   (error "No next method for generic function.")
    2809                                   (funcall next-emfun (or cnm-args args))))
    2810                             (next-method-p ()
    2811                               (not (null next-emfun))))
    2812                        (declare (ignorable (function call-next-method)
    2813                                            (function next-method-p)))
     2802                     (flet-call-next-method args next-emfun
    28142803                       ,@body))))
    28152804               (t
     
    28172806                   (apply #'(lambda ,lambda-list
    28182807                              ,@declarations
    2819                               (flet ((call-next-method (&rest cnm-args)
    2820                                        (if (null next-emfun)
    2821                                            (error "No next method for generic function.")
    2822                                            (funcall next-emfun (or cnm-args args))))
    2823                                      (next-method-p ()
    2824                                        (not (null next-emfun))))
    2825                                 (declare (ignorable (function call-next-method)
    2826                                                     (function next-method-p)))
     2808                              (flet-call-next-method args next-emfun
    28272809                                ,@body))
    28282810                          args))))
     
    28302812                (apply #'(lambda ,lambda-list
    28312813                           ,@declarations
    2832                            (flet ((call-next-method (&rest cnm-args)
    2833                                     (if (null next-emfun)
    2834                                         (error "No next method for generic function.")
    2835                                         (funcall next-emfun (or cnm-args args))))
    2836                                   (next-method-p ()
    2837                                     (not (null next-emfun))))
    2838                              (declare (ignorable (function call-next-method)
    2839                                                  (function next-method-p)))
    2840                              
     2814                           (flet-call-next-method args next-emfun
    28412815                             ,@body))
    28422816                       args))))))
     
    28712845                      (next-method-p () nil))
    28722846                 (declare (ignorable (function call-next-method)
    2873                                     (function next-method-p)))
     2847                                     (function next-method-p)))
    28742848                 ,@body))
    28752849            nil))))))
Note: See TracChangeset for help on using the changeset viewer.