diff options
Diffstat (limited to 'lisp/emacs-lisp/byte-run.el')
-rw-r--r-- | lisp/emacs-lisp/byte-run.el | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 366423904db..6412c8cde22 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -222,12 +222,27 @@ So far, FUNCTION can only be a symbol, not a lambda expression." (cadr elem))) val))))) +(defalias 'byte-run--anonymize-arg-list + #'(lambda (arg-list) + (mapcar (lambda (x) + (if (memq x '(&optional &rest)) + x + t)) + arg-list))) + (defalias 'byte-run--set-function-type - #'(lambda (f _args val &optional f2) + #'(lambda (f args val &optional f2) (when (and f2 (not (eq f2 f))) (error "`%s' does not match top level function `%s' inside function type \ declaration" f2 f)) + (unless (and (length= val 3) + (eq (car val) 'function) + (listp (car (cdr val)))) + (error "Type `%s' is not valid a function type" val)) + (unless (equal (byte-run--anonymize-arg-list args) + (byte-run--anonymize-arg-list (car (cdr val)))) + (error "Type `%s' incompatible with function arguments `%s'" val args)) (list 'function-put (list 'quote f) ''function-type (list 'quote val)))) @@ -528,7 +543,7 @@ was first made obsolete, for example a date or a release number." (put obsolete-name 'byte-obsolete-info ;; The second entry used to hold the `byte-compile' handler, but ;; is not used any more nowadays. - (purecopy (list current-name nil when))) + (list current-name nil when)) obsolete-name) (defmacro define-obsolete-function-alias ( obsolete-name current-name when @@ -556,14 +571,15 @@ See the docstrings of `defalias' and `make-obsolete' for more details." &optional access-type) "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. The warning will say that CURRENT-NAME should be used instead. -If CURRENT-NAME is a string, that is the `use instead' message. +If CURRENT-NAME is a string, that is the `use instead' message. If it +is a string, it is passed through `substitute-command-keys'. WHEN should be a string indicating when the variable was first made obsolete, for example a date or a release number. ACCESS-TYPE if non-nil should specify the kind of access that will trigger obsolescence warnings; it can be either `get' or `set'." (byte-run--constant-obsolete-warning obsolete-name) (put obsolete-name 'byte-obsolete-variable - (purecopy (list current-name access-type when))) + (list current-name access-type when)) obsolete-name) (defmacro define-obsolete-variable-alias ( obsolete-name current-name when @@ -618,7 +634,7 @@ obsolete, for example a date or a release number." `(progn (put ,obsolete-face 'face-alias ,current-face) ;; Used by M-x describe-face. - (put ,obsolete-face 'obsolete-face (or (purecopy ,when) t)))) + (put ,obsolete-face 'obsolete-face (or ,when t)))) (defmacro dont-compile (&rest body) "Like `progn', but the body always runs interpreted (not compiled). |