summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAndrea Corallo <acorallo@gnu.org>2024-02-23 10:17:27 +0100
committerAndrea Corallo <acorallo@gnu.org>2024-04-29 18:40:36 +0200
commit1c7b8099839f62ddfaa5a0f87c29bcd905095dee (patch)
tree540faea85ccdd59cd7c501263bf625fc5dece67c /lisp
parent3be382311fa03b9ec9c571b5e5737ff2d51bc2d3 (diff)
downloademacs-1c7b8099839f62ddfaa5a0f87c29bcd905095dee.tar.gz
emacs-1c7b8099839f62ddfaa5a0f87c29bcd905095dee.tar.bz2
emacs-1c7b8099839f62ddfaa5a0f87c29bcd905095dee.zip
* Add function type declarations for Lisp functions
* lisp/emacs-lisp/byte-run.el (byte-run--set-declared-type): Add alias. (defun-declarations-alist): Use it for 'type' declaration.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/byte-run.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index cc176821026..88571593c31 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -217,6 +217,11 @@ So far, FUNCTION can only be a symbol, not a lambda expression."
(cadr elem)))
val)))))
+(defalias 'byte-run--set-declared-type
+ #'(lambda (f _args &rest val)
+ (list 'function-put (list 'quote f)
+ ''declared-type (list 'quote val))))
+
;; Add any new entries to info node `(elisp)Declare Form'.
(defvar defun-declarations-alist
(list
@@ -239,7 +244,8 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.")
(list 'speed #'byte-run--set-speed)
(list 'completion #'byte-run--set-completion)
(list 'modes #'byte-run--set-modes)
- (list 'interactive-args #'byte-run--set-interactive-args))
+ (list 'interactive-args #'byte-run--set-interactive-args)
+ (list 'type #'byte-run--set-declared-type))
"List associating function properties to their macro expansion.
Each element of the list takes the form (PROP FUN) where FUN is
a function. For each (PROP . VALUES) in a function's declaration,