summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp-cstr.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2023-06-04 11:26:22 +0200
committerAndrea Corallo <akrl@sdf.org>2023-06-04 12:53:38 +0200
commit9ed24bfb04f5a878689e09914f1c4b28105ac85e (patch)
treeac7123a7eafb01e21c9ed504c24dab006f1ab363 /lisp/emacs-lisp/comp-cstr.el
parentac1532a7c9a32bb84893f7eb291171e01b99068c (diff)
downloademacs-9ed24bfb04f5a878689e09914f1c4b28105ac85e.tar.gz
emacs-9ed24bfb04f5a878689e09914f1c4b28105ac85e.tar.bz2
emacs-9ed24bfb04f5a878689e09914f1c4b28105ac85e.zip
* 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.
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
-rw-r--r--lisp/emacs-lisp/comp-cstr.el18
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 416ca7f11b0..c5b96a6b629 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -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