diff options
author | Andrea Corallo <akrl@sdf.org> | 2020-09-01 21:28:22 +0200 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2020-09-14 23:06:42 +0200 |
commit | c4cc13917cdf733b142ed2dee9b5aee9df9f8153 (patch) | |
tree | 49eeb62294aef9b2798b84def2776d9ecb5a07c1 /lisp/emacs-lisp | |
parent | 21021e56ad609a459ec117bcfc60b2802176a9a7 (diff) | |
download | emacs-c4cc13917cdf733b142ed2dee9b5aee9df9f8153.tar.gz emacs-c4cc13917cdf733b142ed2dee9b5aee9df9f8153.tar.bz2 emacs-c4cc13917cdf733b142ed2dee9b5aee9df9f8153.zip |
* lisp/emacs-lisp/cl-macs.el (cl-the): Emit compiler hints when native.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index c38019d4a73..7adb9100703 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2329,6 +2329,14 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C). (defmacro cl-the (type form) "Return FORM. If type-checking is enabled, assert that it is of TYPE." (declare (indent 1) (debug (cl-type-spec form))) + ;; When native compiling possibly add the appropriate type hint. + (when (and (boundp 'byte-native-compiling) + byte-native-compiling) + (setf form + (cl-case type + (fixnum `(comp-hint-fixnum ,form)) + (cons `(comp-hint-cons ,form)) + (otherwise form)))) (if (not (or (not (cl--compiling-file)) (< cl--optimize-speed 3) (= cl--optimize-safety 3))) |