diff options
| author | Stefan Monnier | 2015-03-16 16:11:38 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-03-16 16:11:38 -0400 |
| commit | 801eda8a2a00b3f28a69ffe51b05a649fffc5c58 (patch) | |
| tree | 9beec244007c80b46089fd63a2092bf6bcf05238 /test | |
| parent | f925fc93bac41d7622d1af927e33b0e738ff55b0 (diff) | |
| download | emacs-801eda8a2a00b3f28a69ffe51b05a649fffc5c58.tar.gz emacs-801eda8a2a00b3f28a69ffe51b05a649fffc5c58.zip | |
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Optimize &aux.
Rework to avoid cl--do-arglist in more cases; add comments to explain what's
going on.
(cl--do-&aux): New function extracted from cl--do-arglist.
(cl--do-arglist): Use it.
* lisp/emacs-lisp/cl-generic.el: Add Version: header, for ELPA purposes.
Diffstat (limited to 'test')
| -rw-r--r-- | test/automated/cl-lib-tests.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/automated/cl-lib-tests.el b/test/automated/cl-lib-tests.el index 1c36e7d7abf..2c188a40059 100644 --- a/test/automated/cl-lib-tests.el +++ b/test/automated/cl-lib-tests.el | |||
| @@ -427,4 +427,21 @@ | |||
| 427 | (ert-deftest cl-flet-test () | 427 | (ert-deftest cl-flet-test () |
| 428 | (should (equal (cl-flet ((f1 (x) x)) (let ((x #'f1)) (funcall x 5))) 5))) | 428 | (should (equal (cl-flet ((f1 (x) x)) (let ((x #'f1)) (funcall x 5))) 5))) |
| 429 | 429 | ||
| 430 | (ert-deftest cl-lib-test-typep () | ||
| 431 | (cl-deftype cl-lib-test-type (&optional x) `(member ,x)) | ||
| 432 | ;; Make sure we correctly implement the rule that deftype's optional args | ||
| 433 | ;; default to `*' rather than to nil. | ||
| 434 | (should (cl-typep '* 'cl-lib-test-type)) | ||
| 435 | (should-not (cl-typep 1 'cl-lib-test-type))) | ||
| 436 | |||
| 437 | (ert-deftest cl-lib-arglist-performance () | ||
| 438 | ;; An `&aux' should not cause lambda's arglist to be turned into an &rest | ||
| 439 | ;; that's parsed by hand. | ||
| 440 | (should (eq () (nth 1 (nth 1 (macroexpand | ||
| 441 | '(cl-function (lambda (&aux (x 1)) x))))))) | ||
| 442 | (cl-defstruct (cl-lib--s (:constructor cl-lib--s-make (&optional a))) a) | ||
| 443 | ;; Similarly the &cl-defs thingy shouldn't cause fallback to manual parsing | ||
| 444 | ;; of args if the default for optional args is nil. | ||
| 445 | (should (equal '(&optional a) (help-function-arglist 'cl-lib--s-make)))) | ||
| 446 | |||
| 430 | ;;; cl-lib.el ends here | 447 | ;;; cl-lib.el ends here |