1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

* Have `comp-cstr-to-type-spec' handle comp-cstr-f as well

* lisp/emacs-lisp/comp-cstr.el (comp--simple-cstr-to-type-spec): New
function.
(comp-cstr-to-type-spec): Make use of.
This commit is contained in:
Andrea Corallo 2023-06-04 11:26:22 +02:00
parent ac1532a7c9
commit 9ed24bfb04

View file

@ -1181,8 +1181,8 @@ FN non-nil indicates we are parsing a function lambda list."
:ret (comp-type-spec-to-cstr ret)))
(_ (error "Invalid type specifier"))))
(defun comp-cstr-to-type-spec (cstr)
"Given CSTR return its type specifier."
(defun comp--simple-cstr-to-type-spec (cstr)
"Given a non comp-cstr-f CSTR return its type specifier."
(let ((valset (comp-cstr-valset cstr))
(typeset (comp-cstr-typeset cstr))
(range (comp-cstr-range cstr))
@ -1236,6 +1236,20 @@ FN non-nil indicates we are parsing a function lambda list."
`(not ,final)
final))))
(defun comp-cstr-to-type-spec (cstr)
"Given CSTR return its type specifier."
(cl-etypecase cstr
(comp-cstr-f
`(function
,(mapcar (lambda (x)
(cl-etypecase x
(comp-cstr (comp-cstr-to-type-spec x))
(symbol x)))
(comp-cstr-f-args cstr))
,(comp--simple-cstr-to-type-spec (comp-cstr-f-ret cstr))))
(comp-cstr
(comp--simple-cstr-to-type-spec cstr))))
(provide 'comp-cstr)
;;; comp-cstr.el ends here