aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-06-20 21:43:56 -0400
committerStefan Monnier2011-06-20 21:43:56 -0400
commit478d6f95ff1349434dd7880a7e67d7e288e32972 (patch)
tree5c134974fce75f2b1ed8917884e1d7d26b2f990c
parentca5307394f6861fc825434c268e0a44adf8a3252 (diff)
downloademacs-478d6f95ff1349434dd7880a7e67d7e288e32972.tar.gz
emacs-478d6f95ff1349434dd7880a7e67d7e288e32972.zip
* lisp/emacs-lisp/bytecomp.el (add-to-list): Add handler to check the
variable's status.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/emacs-lisp/bytecomp.el19
2 files changed, 24 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 76339320b83..f0039e0b613 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-06-21 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/bytecomp.el (add-to-list): Add handler to check the
4 variable's status.
5
12011-06-20 Jan Djärv <jan.h.d@swipnet.se> 62011-06-20 Jan Djärv <jan.h.d@swipnet.se>
2 7
3 * x-dnd.el (x-dnd-version-from-flags) 8 * x-dnd.el (x-dnd-version-from-flags)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 1e7ee315942..127f93c6858 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -4244,6 +4244,25 @@ binding slots have been popped."
4244(defun byte-compile-form-make-variable-buffer-local (form) 4244(defun byte-compile-form-make-variable-buffer-local (form)
4245 (byte-compile-keep-pending form 'byte-compile-normal-call)) 4245 (byte-compile-keep-pending form 'byte-compile-normal-call))
4246 4246
4247(byte-defop-compiler-1 add-to-list byte-compile-add-to-list)
4248(defun byte-compile-add-to-list (form)
4249 ;; FIXME: This could be used for `set' as well, except that it's got
4250 ;; its own opcode, so the final `byte-compile-normal-call' needs to
4251 ;; be replaced with something else.
4252 (pcase form
4253 (`(,fun ',var . ,_)
4254 (byte-compile-check-variable var 'assign)
4255 (if (assq var byte-compile--lexical-environment)
4256 (byte-compile-log-warning
4257 (format "%s cannot use lexical var `%s'" fun var)
4258 nil :error)
4259 (unless (or (not (byte-compile-warning-enabled-p 'free-vars))
4260 (boundp var)
4261 (memq var byte-compile-bound-variables)
4262 (memq var byte-compile-free-references))
4263 (byte-compile-warn "assignment to free variable `%S'" var)
4264 (push var byte-compile-free-references)))))
4265 (byte-compile-normal-call form))
4247 4266
4248;;; tags 4267;;; tags
4249 4268