diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2021-04-09 18:59:09 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2021-04-09 19:20:55 +0200 |
commit | 59342f689eaa4839b0fc15351ae48b4f1074a6fc (patch) | |
tree | d0778dc9d0ce81fba4ec9e8b36797ce946d73497 /lisp/emacs-lisp/byte-opt.el | |
parent | b7a7e879d02570cbf74aa87686b6b0ed4e6b0c3b (diff) | |
download | emacs-59342f689eaa4839b0fc15351ae48b4f1074a6fc.tar.gz emacs-59342f689eaa4839b0fc15351ae48b4f1074a6fc.tar.bz2 emacs-59342f689eaa4839b0fc15351ae48b4f1074a6fc.zip |
Fix condition-case optimiser bug
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't
perform incorrect optimisations when a condition-case variable shadows
another lexical variable.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
New test case.
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index db8d825cfec..e5265375314 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -528,8 +528,14 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.") `(condition-case ,var ;Not evaluated. ,(byte-optimize-form exp for-effect) ,@(mapcar (lambda (clause) - `(,(car clause) - ,@(byte-optimize-body (cdr clause) for-effect))) + (let ((byte-optimize--lexvars + (and lexical-binding + (if var + (cons (list var t) + byte-optimize--lexvars) + byte-optimize--lexvars)))) + (cons (car clause) + (byte-optimize-body (cdr clause) for-effect)))) clauses)))) (`(unwind-protect ,exp . ,exps) |