X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fwalk.lisp;h=c8401d43c31febb28f4e37b8dfc029aebc862e82;hb=8ae1a092ca40928020e48a588f6c47d18d334efe;hp=ac68857dcdb9acba48ba199cd1512a9a8ea486a1;hpb=724b51e6acb1fd0040de3751c9e4566e7a87ced3;p=sbcl.git diff --git a/src/pcl/walk.lisp b/src/pcl/walk.lisp index ac68857..c8401d4 100644 --- a/src/pcl/walk.lisp +++ b/src/pcl/walk.lisp @@ -358,13 +358,19 @@ `(eval-when (:load-toplevel :execute) (setf (get-walker-template-internal ',name) ',template))) -(defun get-walker-template (x) +(defun get-walker-template (x context) (cond ((symbolp x) (get-walker-template-internal x)) ((and (listp x) (eq (car x) 'lambda)) '(lambda repeat (eval))) (t - (error "can't get template for ~S" x)))) + ;; FIXME: In an ideal world we would do something similar to + ;; COMPILER-ERROR here, replacing the form within the walker + ;; with an error-signalling form. This is slightly less + ;; pretty, but informative non the less. Best is the enemy of + ;; good, etc. + (error "Illegal function call in method body:~% ~S" + context)))) ;;;; the actual templates @@ -452,7 +458,7 @@ newform))) (t (let* ((fn (car newform)) - (template (get-walker-template fn))) + (template (get-walker-template fn newform))) (if template (if (symbolp template) (funcall template newform context env) @@ -534,12 +540,8 @@ (defun walk-template-handle-repeat (form template stop-form context env) (if (eq form stop-form) (walk-template form (cdr template) context env) - (walk-template-handle-repeat-1 form - template - (car template) - stop-form - context - env))) + (walk-template-handle-repeat-1 + form template (car template) stop-form context env))) (defun walk-template-handle-repeat-1 (form template repeat-template stop-form context env) @@ -548,7 +550,7 @@ (if (null repeat-template) (walk-template stop-form (cdr template) context env) (error "while handling code walker REPEAT: - ~%ran into STOP while still in REPEAT template"))) + ~%ran into STOP while still in REPEAT template"))) ((null repeat-template) (walk-template-handle-repeat-1 form template (car template) stop-form context env)) @@ -623,7 +625,7 @@ (cdr body) fn env doc-string-p declarations))) ((and form (listp form) - (null (get-walker-template (car form))) + (null (get-walker-template (car form) form)) (progn (multiple-value-setq (new-form macrop) (sb-xc:macroexpand-1 form env))