Skip to content

Commit

Permalink
micros/walker: fix walker for sb-int:named-lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Dec 17, 2023
1 parent 80c093d commit eeae910
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions contrib/walker/walker.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -526,23 +526,32 @@
:path path)
env)))

(defun walk-lambda-list-and-body (walker lambda-list body env path)
(multiple-value-bind (body declare-forms documentation)
(parse-body body :documentation t)
(let ((declaration-spec (parse-declaration-specifiers declare-forms)))
(multiple-value-bind (lambda-list env)
(walk-lambda-list walker
lambda-list
env
(cons 1 path)
:declaration-spec declaration-spec)
(make-instance 'lambda-form
:documentation documentation
:lambda-list lambda-list
:body (walk-forms walker body env path (+ 2 (length declare-forms)))
:path (cons 0 path))))))

(defmethod walk-lambda-form ((walker walker) form env path)
(assert-type (first form) '(member lambda #+sbcl sb-int:named-lambda))
(with-walker-bindings (lambda-list &body body) (rest form)
(multiple-value-bind (body declare-forms documentation)
(parse-body body :documentation t)
(let ((declaration-spec (parse-declaration-specifiers declare-forms)))
(multiple-value-bind (lambda-list env)
(walk-lambda-list walker
lambda-list
env
(cons 1 path)
:declaration-spec declaration-spec)
(make-instance 'lambda-form
:documentation documentation
:lambda-list lambda-list
:body (walk-forms walker body env path (+ 2 (length declare-forms)))
:path (cons 0 path)))))))
(ecase (first form)
((lambda)
(with-walker-bindings (lambda-list &body body) (rest form)
(walk-lambda-list-and-body walker lambda-list body env path)))
((sb-int:named-lambda)
(with-walker-bindings (name lambda-list &body body) (rest form)
(declare (ignore name)) ; TODO
(walk-lambda-list-and-body walker lambda-list body env path)))))

(defmethod walk-form ((walker walker) (name (eql 'function)) form env path)
(with-walker-bindings (thing) (rest form)
Expand Down

0 comments on commit eeae910

Please sign in to comment.