summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-06-03 20:31:10 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2022-06-14 20:19:59 +0200
commit6825e5686a4bf21f5d5a0ae1af889097cfa2f597 (patch)
treea296141574d6ac3bc085df708d3feeb817f83204 /test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el
parent175bc8e5a53740432c844b5aae1981d4f47c96f7 (diff)
downloademacs-6825e5686a4bf21f5d5a0ae1af889097cfa2f597.tar.gz
emacs-6825e5686a4bf21f5d5a0ae1af889097cfa2f597.tar.bz2
emacs-6825e5686a4bf21f5d5a0ae1af889097cfa2f597.zip
Normalise setq during macro-expansion
Early normalisation of setq during macroexpand-all allows later stages, cconv, byte-opt and codegen, to be simplified and duplicated checks to be eliminated. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Normalise all setq forms to a sequence of (setq VAR EXPR). Emit warnings if necessary. * lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyze-form): * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): * lisp/emacs-lisp/bytecomp.el (byte-compile-setq): Simplify. * test/lisp/emacs-lisp/bytecomp-tests.el: Adapt and add tests. * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el; * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-odd.el: New files.
Diffstat (limited to 'test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el b/test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el
new file mode 100644
index 00000000000..5a56913cd9b
--- /dev/null
+++ b/test/lisp/emacs-lisp/bytecomp-resources/warn-variable-setq-nonvariable.el
@@ -0,0 +1,3 @@
+;;; -*- lexical-binding: t -*-
+(defun foo ()
+ (setq (a) nil))