diff options
| author | Mark Oteiza | 2017-02-15 20:40:46 -0500 |
|---|---|---|
| committer | Mark Oteiza | 2017-02-15 20:40:46 -0500 |
| commit | 1b4442bee921d6698fc8ecac1c95c39f7ca2efe4 (patch) | |
| tree | 48aab38b6253df79621b1f737179660a685cf906 | |
| parent | 8ed8ef307d9a28f6c3336a448c7fbdfe8a733d83 (diff) | |
| download | emacs-1b4442bee921d6698fc8ecac1c95c39f7ca2efe4.tar.gz emacs-1b4442bee921d6698fc8ecac1c95c39f7ca2efe4.zip | |
Don't expand body inside a let-binding when there are no bindings
* lisp/emacs-lisp/pcase.el (pcase-codegen): Only let-bind if VARS
is non-nil.
| -rw-r--r-- | lisp/emacs-lisp/pcase.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 46a5eedd150..289265abf27 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el | |||
| @@ -437,8 +437,10 @@ to this macro." | |||
| 437 | ;; Don't use let*, otherwise macroexp-let* may merge it with some surrounding | 437 | ;; Don't use let*, otherwise macroexp-let* may merge it with some surrounding |
| 438 | ;; let* which might prevent the setcar/setcdr in pcase--expand's fancy | 438 | ;; let* which might prevent the setcar/setcdr in pcase--expand's fancy |
| 439 | ;; codegen from later metamorphosing this let into a funcall. | 439 | ;; codegen from later metamorphosing this let into a funcall. |
| 440 | `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars) | 440 | (if vars |
| 441 | ,@code)) | 441 | `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars) |
| 442 | ,@code) | ||
| 443 | `(progn ,@code))) | ||
| 442 | 444 | ||
| 443 | (defun pcase--small-branch-p (code) | 445 | (defun pcase--small-branch-p (code) |
| 444 | (and (= 1 (length code)) | 446 | (and (= 1 (length code)) |