diff options
| author | Andrea Corallo | 2019-12-08 20:52:34 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:38:12 +0100 |
| commit | 6c9acd13d0d2aa181d21bf78d6530b3399520533 (patch) | |
| tree | 8ad39ceae1030f3c9de8903c4200072194665d09 | |
| parent | b3db331e8c36ef9706ad16c12055079bcd93c022 (diff) | |
| download | emacs-6c9acd13d0d2aa181d21bf78d6530b3399520533.tar.gz emacs-6c9acd13d0d2aa181d21bf78d6530b3399520533.zip | |
single function native compilation doc + interactive support + tests
| -rw-r--r-- | lisp/emacs-lisp/comp.el | 4 | ||||
| -rw-r--r-- | test/src/comp-tests.el | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index ffd4985301e..0f0a90c82fb 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el | |||
| @@ -420,7 +420,9 @@ Put PREFIX in front of it." | |||
| 420 | "Byte compile FUNCTION-NAME spilling data from the byte compiler." | 420 | "Byte compile FUNCTION-NAME spilling data from the byte compiler." |
| 421 | (let* ((f (symbol-function function-name)) | 421 | (let* ((f (symbol-function function-name)) |
| 422 | (func (make-comp-func :name function-name | 422 | (func (make-comp-func :name function-name |
| 423 | :c-name (comp-c-func-name function-name"F")))) | 423 | :c-name (comp-c-func-name function-name"F") |
| 424 | :doc (documentation f) | ||
| 425 | :int-spec (interactive-form f)))) | ||
| 424 | (when (byte-code-function-p f) | 426 | (when (byte-code-function-p f) |
| 425 | (signal 'native-compiler-error | 427 | (signal 'native-compiler-error |
| 426 | "can't native compile an already bytecompiled function")) | 428 | "can't native compile an already bytecompiled function")) |
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 230d5bfbdaf..82a30424d09 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -328,10 +328,18 @@ Check that the resulting binaries do not differ." | |||
| 328 | (ert-deftest comp-tests-free-fun () | 328 | (ert-deftest comp-tests-free-fun () |
| 329 | "Check we are able to compile a single function." | 329 | "Check we are able to compile a single function." |
| 330 | (defun comp-tests-free-fun-f () | 330 | (defun comp-tests-free-fun-f () |
| 331 | "Some doc." | ||
| 332 | (interactive) | ||
| 331 | 3) | 333 | 3) |
| 332 | (load (native-compile #'comp-tests-free-fun-f)) | 334 | (load (native-compile #'comp-tests-free-fun-f)) |
| 335 | |||
| 333 | (should (subr-native-elisp-p (symbol-function #'comp-tests-free-fun-f))) | 336 | (should (subr-native-elisp-p (symbol-function #'comp-tests-free-fun-f))) |
| 334 | (should (= (comp-tests-free-fun-f) 3))) | 337 | (should (= (comp-tests-free-fun-f) 3)) |
| 338 | (should (string= (documentation #'comp-tests-free-fun-f) | ||
| 339 | "Some doc.")) | ||
| 340 | (should (commandp #'comp-tests-free-fun-f)) | ||
| 341 | (should (equal (interactive-form #'comp-tests-free-fun-f) | ||
| 342 | '(interactive)))) | ||
| 335 | 343 | ||
| 336 | 344 | ||
| 337 | ;;;;;;;;;;;;;;;;;;;; | 345 | ;;;;;;;;;;;;;;;;;;;; |