[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104648: * lisp/emacs-lisp/bytecomp.e
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104648: * lisp/emacs-lisp/bytecomp.el (add-to-list): Add handler to check the |
Date: |
Mon, 20 Jun 2011 21:43:56 -0400 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104648
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2011-06-20 21:43:56 -0400
message:
* lisp/emacs-lisp/bytecomp.el (add-to-list): Add handler to check the
variable's status.
modified:
lisp/ChangeLog
lisp/emacs-lisp/bytecomp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-06-20 20:49:12 +0000
+++ b/lisp/ChangeLog 2011-06-21 01:43:56 +0000
@@ -1,3 +1,8 @@
+2011-06-21 Stefan Monnier <address@hidden>
+
+ * emacs-lisp/bytecomp.el (add-to-list): Add handler to check the
+ variable's status.
+
2011-06-20 Jan Djärv <address@hidden>
* x-dnd.el (x-dnd-version-from-flags)
=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- a/lisp/emacs-lisp/bytecomp.el 2011-06-01 19:32:04 +0000
+++ b/lisp/emacs-lisp/bytecomp.el 2011-06-21 01:43:56 +0000
@@ -4244,6 +4244,25 @@
(defun byte-compile-form-make-variable-buffer-local (form)
(byte-compile-keep-pending form 'byte-compile-normal-call))
+(byte-defop-compiler-1 add-to-list byte-compile-add-to-list)
+(defun byte-compile-add-to-list (form)
+ ;; FIXME: This could be used for `set' as well, except that it's got
+ ;; its own opcode, so the final `byte-compile-normal-call' needs to
+ ;; be replaced with something else.
+ (pcase form
+ (`(,fun ',var . ,_)
+ (byte-compile-check-variable var 'assign)
+ (if (assq var byte-compile--lexical-environment)
+ (byte-compile-log-warning
+ (format "%s cannot use lexical var `%s'" fun var)
+ nil :error)
+ (unless (or (not (byte-compile-warning-enabled-p 'free-vars))
+ (boundp var)
+ (memq var byte-compile-bound-variables)
+ (memq var byte-compile-free-references))
+ (byte-compile-warn "assignment to free variable `%S'" var)
+ (push var byte-compile-free-references)))))
+ (byte-compile-normal-call form))
;;; tags
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104648: * lisp/emacs-lisp/bytecomp.el (add-to-list): Add handler to check the,
Stefan Monnier <=