mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 18:41:25 -08:00
* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-defvar-function):
Warn about defvaralias that follows instead of precedes its var.
This commit is contained in:
parent
71b108a5d7
commit
495963cfaf
1 changed files with 9 additions and 0 deletions
|
|
@ -2426,6 +2426,15 @@ list that represents a doc string reference.
|
|||
(defun byte-compile-file-form-defvar-function (form)
|
||||
(pcase-let (((or `',name (let name nil)) (nth 1 form)))
|
||||
(if name (byte-compile--declare-var name)))
|
||||
;; Variable aliases are better declared before the corresponding variable,
|
||||
;; since it makes it more likely that only one of the two vars has a value
|
||||
;; before the `defvaralias' gets executed, which avoids the need to
|
||||
;; merge values.
|
||||
(pcase form
|
||||
(`(defvaralias ,_ ',newname . ,_)
|
||||
(when (memq newname byte-compile-bound-variables)
|
||||
(byte-compile-warn
|
||||
"Alias for `%S' should be declared before its referent" newname))))
|
||||
(byte-compile-keep-pending form))
|
||||
|
||||
(put 'custom-declare-variable 'byte-hunk-handler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue