diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2021-07-21 10:54:43 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2021-07-21 11:17:18 +0200 |
commit | 070c80ee06664c90fb9c96a1b9c89f7b844ae712 (patch) | |
tree | 07712467dcbaf6eec175628bb63f42edd5badd3b /lisp/emacs-lisp | |
parent | 1b251ed4e8550c889d17fe7d88f58aa2fbc95fe0 (diff) | |
download | emacs-070c80ee06664c90fb9c96a1b9c89f7b844ae712.tar.gz emacs-070c80ee06664c90fb9c96a1b9c89f7b844ae712.tar.bz2 emacs-070c80ee06664c90fb9c96a1b9c89f7b844ae712.zip |
Fix mistake in `quote` optimiser
Found by Pip Cet.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-quote): Fix mistake that
made this optimiser ineffective at removing quoting of nil, t, and
keywords. The only obvious consequence is that we no longer need...
(byte-optimize-form): ...a 'nil => nil normalising step here; remove.
(byte-optimize-form-code-walker): Make the compiler warn about (quote).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index c9c0ac0045e..341643c7d16 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -414,7 +414,7 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.") form))) (t form))) (`(quote . ,v) - (if (cdr v) + (if (or (not v) (cdr v)) (byte-compile-warn "malformed quote form: `%s'" (prin1-to-string form))) ;; Map (quote nil) to nil to simplify optimizer logic. @@ -667,8 +667,7 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.") (byte-compile-log " %s\t==>\t%s" old new) (setq form new) (not (eq new old)))))))) - ;; Normalise (quote nil) to nil, for a single representation of constant nil. - (and (not (equal form '(quote nil))) form)) + form) (defun byte-optimize-let-form (head form for-effect) ;; Recursively enter the optimizer for the bindings and body @@ -1077,7 +1076,7 @@ See Info node `(elisp) Integer Basics'." (defun byte-optimize-quote (form) (if (or (consp (nth 1 form)) (and (symbolp (nth 1 form)) - (not (macroexp--const-symbol-p form)))) + (not (macroexp--const-symbol-p (nth 1 form))))) form (nth 1 form))) |