Improve find-builtin-symbols

This commit is contained in:
paku 2024-05-27 19:11:27 +09:00
parent 458785bfb1
commit d10b24c2c8

View file

@ -45,15 +45,13 @@
(error "The body of the hsx macro must be a single form.")) (error "The body of the hsx macro must be a single form."))
(find-builtin-symbols (car form))) (find-builtin-symbols (car form)))
(defun find-builtin-symbols (tree) (defun find-builtin-symbols (node)
(if tree (if (atom node)
(cons (let ((first-node (first tree))) (or (find-symbol (string node) :hsx/builtin)
(if (listp first-node) node)
(find-builtin-symbols first-node) (cons (find-builtin-symbols (car node))
(or (find-symbol (string first-node) :hsx/builtin) (mapcar (lambda (n)
first-node))) (if (listp n)
(mapcar (lambda (node) (find-builtin-symbols n)
(if (listp node) n))
(find-builtin-symbols node) (cdr node)))))
node))
(rest tree)))))