diff options
| author | Glenn Morris | 2009-09-15 02:34:32 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-09-15 02:34:32 +0000 |
| commit | c276856990ea90210a2b446e710f29102e45ac25 (patch) | |
| tree | 524d16bf68dc3f0cd828bc860713de7922539ff1 | |
| parent | fe6793d4f8a038fe0a8932a2c3979350e1712ca4 (diff) | |
| download | emacs-c276856990ea90210a2b446e710f29102e45ac25.tar.gz emacs-c276856990ea90210a2b446e710f29102e45ac25.zip | |
(byte-compile-keep-pending, byte-compile-file-form, byte-compile-lambda)
(byte-compile-top-level-body, byte-compile-form)
(byte-compile-variable-ref, byte-compile-setq)
(byte-compile-setq-default, byte-compile-body)
(byte-compile-body-do-effect, byte-compile-and, byte-compile-or)
(batch-byte-compile): Give some more local variables with common names
a "bytecomp-" prefix to avoid masking warnings about free variables.
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 233 |
1 files changed, 122 insertions, 111 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 52994e1fbcf..60341974c5d 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2234,17 +2234,17 @@ list that represents a doc string reference. | |||
| 2234 | (insert (nth 2 info))))) | 2234 | (insert (nth 2 info))))) |
| 2235 | nil) | 2235 | nil) |
| 2236 | 2236 | ||
| 2237 | (defun byte-compile-keep-pending (form &optional handler) | 2237 | (defun byte-compile-keep-pending (form &optional bytecomp-handler) |
| 2238 | (if (memq byte-optimize '(t source)) | 2238 | (if (memq byte-optimize '(t source)) |
| 2239 | (setq form (byte-optimize-form form t))) | 2239 | (setq form (byte-optimize-form form t))) |
| 2240 | (if handler | 2240 | (if bytecomp-handler |
| 2241 | (let ((for-effect t)) | 2241 | (let ((for-effect t)) |
| 2242 | ;; To avoid consing up monstrously large forms at load time, we split | 2242 | ;; To avoid consing up monstrously large forms at load time, we split |
| 2243 | ;; the output regularly. | 2243 | ;; the output regularly. |
| 2244 | (and (memq (car-safe form) '(fset defalias)) | 2244 | (and (memq (car-safe form) '(fset defalias)) |
| 2245 | (nthcdr 300 byte-compile-output) | 2245 | (nthcdr 300 byte-compile-output) |
| 2246 | (byte-compile-flush-pending)) | 2246 | (byte-compile-flush-pending)) |
| 2247 | (funcall handler form) | 2247 | (funcall bytecomp-handler form) |
| 2248 | (if for-effect | 2248 | (if for-effect |
| 2249 | (byte-compile-discard))) | 2249 | (byte-compile-discard))) |
| 2250 | (byte-compile-form form t)) | 2250 | (byte-compile-form form t)) |
| @@ -2265,13 +2265,13 @@ list that represents a doc string reference. | |||
| 2265 | 2265 | ||
| 2266 | (defun byte-compile-file-form (form) | 2266 | (defun byte-compile-file-form (form) |
| 2267 | (let ((byte-compile-current-form nil) ; close over this for warnings. | 2267 | (let ((byte-compile-current-form nil) ; close over this for warnings. |
| 2268 | handler) | 2268 | bytecomp-handler) |
| 2269 | (cond | 2269 | (cond |
| 2270 | ((not (consp form)) | 2270 | ((not (consp form)) |
| 2271 | (byte-compile-keep-pending form)) | 2271 | (byte-compile-keep-pending form)) |
| 2272 | ((and (symbolp (car form)) | 2272 | ((and (symbolp (car form)) |
| 2273 | (setq handler (get (car form) 'byte-hunk-handler))) | 2273 | (setq bytecomp-handler (get (car form) 'byte-hunk-handler))) |
| 2274 | (cond ((setq form (funcall handler form)) | 2274 | (cond ((setq form (funcall bytecomp-handler form)) |
| 2275 | (byte-compile-flush-pending) | 2275 | (byte-compile-flush-pending) |
| 2276 | (byte-compile-output-file-form form)))) | 2276 | (byte-compile-output-file-form form)))) |
| 2277 | ((eq form (setq form (macroexpand form byte-compile-macro-environment))) | 2277 | ((eq form (setq form (macroexpand form byte-compile-macro-environment))) |
| @@ -2704,76 +2704,79 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2704 | ;; of the list FUN and `byte-compile-set-symbol-position' is not called. | 2704 | ;; of the list FUN and `byte-compile-set-symbol-position' is not called. |
| 2705 | ;; Use this feature to avoid calling `byte-compile-set-symbol-position' | 2705 | ;; Use this feature to avoid calling `byte-compile-set-symbol-position' |
| 2706 | ;; for symbols generated by the byte compiler itself. | 2706 | ;; for symbols generated by the byte compiler itself. |
| 2707 | (defun byte-compile-lambda (fun &optional add-lambda) | 2707 | (defun byte-compile-lambda (bytecomp-fun &optional add-lambda) |
| 2708 | (if add-lambda | 2708 | (if add-lambda |
| 2709 | (setq fun (cons 'lambda fun)) | 2709 | (setq bytecomp-fun (cons 'lambda bytecomp-fun)) |
| 2710 | (unless (eq 'lambda (car-safe fun)) | 2710 | (unless (eq 'lambda (car-safe bytecomp-fun)) |
| 2711 | (error "Not a lambda list: %S" fun)) | 2711 | (error "Not a lambda list: %S" bytecomp-fun)) |
| 2712 | (byte-compile-set-symbol-position 'lambda)) | 2712 | (byte-compile-set-symbol-position 'lambda)) |
| 2713 | (byte-compile-check-lambda-list (nth 1 fun)) | 2713 | (byte-compile-check-lambda-list (nth 1 bytecomp-fun)) |
| 2714 | (let* ((arglist (nth 1 fun)) | 2714 | (let* ((bytecomp-arglist (nth 1 bytecomp-fun)) |
| 2715 | (byte-compile-bound-variables | 2715 | (byte-compile-bound-variables |
| 2716 | (nconc (and (byte-compile-warning-enabled-p 'free-vars) | 2716 | (nconc (and (byte-compile-warning-enabled-p 'free-vars) |
| 2717 | (delq '&rest (delq '&optional (copy-sequence arglist)))) | 2717 | (delq '&rest |
| 2718 | (delq '&optional (copy-sequence bytecomp-arglist)))) | ||
| 2718 | byte-compile-bound-variables)) | 2719 | byte-compile-bound-variables)) |
| 2719 | (body (cdr (cdr fun))) | 2720 | (bytecomp-body (cdr (cdr bytecomp-fun))) |
| 2720 | (doc (if (stringp (car body)) | 2721 | (bytecomp-doc (if (stringp (car bytecomp-body)) |
| 2721 | (prog1 (car body) | 2722 | (prog1 (car bytecomp-body) |
| 2722 | ;; Discard the doc string | 2723 | ;; Discard the doc string |
| 2723 | ;; unless it is the last element of the body. | 2724 | ;; unless it is the last element of the body. |
| 2724 | (if (cdr body) | 2725 | (if (cdr bytecomp-body) |
| 2725 | (setq body (cdr body)))))) | 2726 | (setq bytecomp-body (cdr bytecomp-body)))))) |
| 2726 | (int (assq 'interactive body))) | 2727 | (bytecomp-int (assq 'interactive bytecomp-body))) |
| 2727 | ;; Process the interactive spec. | 2728 | ;; Process the interactive spec. |
| 2728 | (when int | 2729 | (when bytecomp-int |
| 2729 | (byte-compile-set-symbol-position 'interactive) | 2730 | (byte-compile-set-symbol-position 'interactive) |
| 2730 | ;; Skip (interactive) if it is in front (the most usual location). | 2731 | ;; Skip (interactive) if it is in front (the most usual location). |
| 2731 | (if (eq int (car body)) | 2732 | (if (eq bytecomp-int (car bytecomp-body)) |
| 2732 | (setq body (cdr body))) | 2733 | (setq bytecomp-body (cdr bytecomp-body))) |
| 2733 | (cond ((consp (cdr int)) | 2734 | (cond ((consp (cdr bytecomp-int)) |
| 2734 | (if (cdr (cdr int)) | 2735 | (if (cdr (cdr bytecomp-int)) |
| 2735 | (byte-compile-warn "malformed interactive spec: %s" | 2736 | (byte-compile-warn "malformed interactive spec: %s" |
| 2736 | (prin1-to-string int))) | 2737 | (prin1-to-string bytecomp-int))) |
| 2737 | ;; If the interactive spec is a call to `list', don't | 2738 | ;; If the interactive spec is a call to `list', don't |
| 2738 | ;; compile it, because `call-interactively' looks at the | 2739 | ;; compile it, because `call-interactively' looks at the |
| 2739 | ;; args of `list'. Actually, compile it to get warnings, | 2740 | ;; args of `list'. Actually, compile it to get warnings, |
| 2740 | ;; but don't use the result. | 2741 | ;; but don't use the result. |
| 2741 | (let ((form (nth 1 int))) | 2742 | (let ((form (nth 1 bytecomp-int))) |
| 2742 | (while (memq (car-safe form) '(let let* progn save-excursion)) | 2743 | (while (memq (car-safe form) '(let let* progn save-excursion)) |
| 2743 | (while (consp (cdr form)) | 2744 | (while (consp (cdr form)) |
| 2744 | (setq form (cdr form))) | 2745 | (setq form (cdr form))) |
| 2745 | (setq form (car form))) | 2746 | (setq form (car form))) |
| 2746 | (if (eq (car-safe form) 'list) | 2747 | (if (eq (car-safe form) 'list) |
| 2747 | (byte-compile-top-level (nth 1 int)) | 2748 | (byte-compile-top-level (nth 1 bytecomp-int)) |
| 2748 | (setq int (list 'interactive | 2749 | (setq bytecomp-int (list 'interactive |
| 2749 | (byte-compile-top-level (nth 1 int))))))) | 2750 | (byte-compile-top-level |
| 2750 | ((cdr int) | 2751 | (nth 1 bytecomp-int))))))) |
| 2752 | ((cdr bytecomp-int) | ||
| 2751 | (byte-compile-warn "malformed interactive spec: %s" | 2753 | (byte-compile-warn "malformed interactive spec: %s" |
| 2752 | (prin1-to-string int))))) | 2754 | (prin1-to-string bytecomp-int))))) |
| 2753 | ;; Process the body. | 2755 | ;; Process the body. |
| 2754 | (let ((compiled (byte-compile-top-level (cons 'progn body) nil 'lambda))) | 2756 | (let ((compiled (byte-compile-top-level |
| 2757 | (cons 'progn bytecomp-body) nil 'lambda))) | ||
| 2755 | ;; Build the actual byte-coded function. | 2758 | ;; Build the actual byte-coded function. |
| 2756 | (if (and (eq 'byte-code (car-safe compiled)) | 2759 | (if (and (eq 'byte-code (car-safe compiled)) |
| 2757 | (not (byte-compile-version-cond | 2760 | (not (byte-compile-version-cond |
| 2758 | byte-compile-compatibility))) | 2761 | byte-compile-compatibility))) |
| 2759 | (apply 'make-byte-code | 2762 | (apply 'make-byte-code |
| 2760 | (append (list arglist) | 2763 | (append (list bytecomp-arglist) |
| 2761 | ;; byte-string, constants-vector, stack depth | 2764 | ;; byte-string, constants-vector, stack depth |
| 2762 | (cdr compiled) | 2765 | (cdr compiled) |
| 2763 | ;; optionally, the doc string. | 2766 | ;; optionally, the doc string. |
| 2764 | (if (or doc int) | 2767 | (if (or bytecomp-doc bytecomp-int) |
| 2765 | (list doc)) | 2768 | (list bytecomp-doc)) |
| 2766 | ;; optionally, the interactive spec. | 2769 | ;; optionally, the interactive spec. |
| 2767 | (if int | 2770 | (if bytecomp-int |
| 2768 | (list (nth 1 int))))) | 2771 | (list (nth 1 bytecomp-int))))) |
| 2769 | (setq compiled | 2772 | (setq compiled |
| 2770 | (nconc (if int (list int)) | 2773 | (nconc (if bytecomp-int (list bytecomp-int)) |
| 2771 | (cond ((eq (car-safe compiled) 'progn) (cdr compiled)) | 2774 | (cond ((eq (car-safe compiled) 'progn) (cdr compiled)) |
| 2772 | (compiled (list compiled))))) | 2775 | (compiled (list compiled))))) |
| 2773 | (nconc (list 'lambda arglist) | 2776 | (nconc (list 'lambda bytecomp-arglist) |
| 2774 | (if (or doc (stringp (car compiled))) | 2777 | (if (or bytecomp-doc (stringp (car compiled))) |
| 2775 | (cons doc (cond (compiled) | 2778 | (cons bytecomp-doc (cond (compiled) |
| 2776 | (body (list nil)))) | 2779 | (bytecomp-body (list nil)))) |
| 2777 | compiled)))))) | 2780 | compiled)))))) |
| 2778 | 2781 | ||
| 2779 | (defun byte-compile-constants-vector () | 2782 | (defun byte-compile-constants-vector () |
| @@ -2917,13 +2920,14 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2917 | ((cdr body) (cons 'progn (nreverse body))) | 2920 | ((cdr body) (cons 'progn (nreverse body))) |
| 2918 | ((car body))))) | 2921 | ((car body))))) |
| 2919 | 2922 | ||
| 2920 | ;; Given BODY, compile it and return a new body. | 2923 | ;; Given BYTECOMP-BODY, compile it and return a new body. |
| 2921 | (defun byte-compile-top-level-body (body &optional for-effect) | 2924 | (defun byte-compile-top-level-body (bytecomp-body &optional for-effect) |
| 2922 | (setq body (byte-compile-top-level (cons 'progn body) for-effect t)) | 2925 | (setq bytecomp-body |
| 2923 | (cond ((eq (car-safe body) 'progn) | 2926 | (byte-compile-top-level (cons 'progn bytecomp-body) for-effect t)) |
| 2924 | (cdr body)) | 2927 | (cond ((eq (car-safe bytecomp-body) 'progn) |
| 2925 | (body | 2928 | (cdr bytecomp-body)) |
| 2926 | (list body)))) | 2929 | (bytecomp-body |
| 2930 | (list bytecomp-body)))) | ||
| 2927 | 2931 | ||
| 2928 | (put 'declare-function 'byte-hunk-handler 'byte-compile-declare-function) | 2932 | (put 'declare-function 'byte-hunk-handler 'byte-compile-declare-function) |
| 2929 | (defun byte-compile-declare-function (form) | 2933 | (defun byte-compile-declare-function (form) |
| @@ -2963,27 +2967,31 @@ If FORM is a lambda or a macro, byte-compile it as a function." | |||
| 2963 | (setq for-effect nil)) | 2967 | (setq for-effect nil)) |
| 2964 | (t (byte-compile-variable-ref 'byte-varref form)))) | 2968 | (t (byte-compile-variable-ref 'byte-varref form)))) |
| 2965 | ((symbolp (car form)) | 2969 | ((symbolp (car form)) |
| 2966 | (let* ((fn (car form)) | 2970 | (let* ((bytecomp-fn (car form)) |
| 2967 | (handler (get fn 'byte-compile))) | 2971 | (bytecomp-handler (get bytecomp-fn 'byte-compile))) |
| 2968 | (when (byte-compile-const-symbol-p fn) | 2972 | (when (byte-compile-const-symbol-p bytecomp-fn) |
| 2969 | (byte-compile-warn "`%s' called as a function" fn)) | 2973 | (byte-compile-warn "`%s' called as a function" bytecomp-fn)) |
| 2970 | (and (byte-compile-warning-enabled-p 'interactive-only) | 2974 | (and (byte-compile-warning-enabled-p 'interactive-only) |
| 2971 | (memq fn byte-compile-interactive-only-functions) | 2975 | (memq bytecomp-fn byte-compile-interactive-only-functions) |
| 2972 | (byte-compile-warn "`%s' used from Lisp code\n\ | 2976 | (byte-compile-warn "`%s' used from Lisp code\n\ |
| 2973 | That command is designed for interactive use only" fn)) | 2977 | That command is designed for interactive use only" bytecomp-fn)) |
| 2974 | (if (and handler | 2978 | (if (and bytecomp-handler |
| 2975 | ;; Make sure that function exists. This is important | 2979 | ;; Make sure that function exists. This is important |
| 2976 | ;; for CL compiler macros since the symbol may be | 2980 | ;; for CL compiler macros since the symbol may be |
| 2977 | ;; `cl-byte-compile-compiler-macro' but if CL isn't | 2981 | ;; `cl-byte-compile-compiler-macro' but if CL isn't |
| 2978 | ;; loaded, this function doesn't exist. | 2982 | ;; loaded, this function doesn't exist. |
| 2979 | (or (not (memq handler '(cl-byte-compile-compiler-macro))) | 2983 | (or (not (memq bytecomp-handler |
| 2980 | (functionp handler)) | 2984 | '(cl-byte-compile-compiler-macro))) |
| 2985 | (functionp bytecomp-handler)) | ||
| 2981 | (not (and (byte-compile-version-cond | 2986 | (not (and (byte-compile-version-cond |
| 2982 | byte-compile-compatibility) | 2987 | byte-compile-compatibility) |
| 2983 | (get (get fn 'byte-opcode) 'emacs19-opcode)))) | 2988 | (get (get bytecomp-fn 'byte-opcode) |
| 2984 | (funcall handler form) | 2989 | 'emacs19-opcode)))) |
| 2990 | (funcall bytecomp-handler form) | ||
| 2985 | (when (byte-compile-warning-enabled-p 'callargs) | 2991 | (when (byte-compile-warning-enabled-p 'callargs) |
| 2986 | (if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face)) | 2992 | (if (memq bytecomp-fn |
| 2993 | '(custom-declare-group custom-declare-variable | ||
| 2994 | custom-declare-face)) | ||
| 2987 | (byte-compile-nogroup-warn form)) | 2995 | (byte-compile-nogroup-warn form)) |
| 2988 | (byte-compile-callargs-warn form)) | 2996 | (byte-compile-callargs-warn form)) |
| 2989 | (byte-compile-normal-call form)) | 2997 | (byte-compile-normal-call form)) |
| @@ -3012,37 +3020,40 @@ That command is designed for interactive use only" fn)) | |||
| 3012 | (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. | 3020 | (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. |
| 3013 | (byte-compile-out 'byte-call (length (cdr form)))) | 3021 | (byte-compile-out 'byte-call (length (cdr form)))) |
| 3014 | 3022 | ||
| 3015 | (defun byte-compile-variable-ref (base-op var) | 3023 | (defun byte-compile-variable-ref (base-op bytecomp-var) |
| 3016 | (when (symbolp var) | 3024 | (when (symbolp bytecomp-var) |
| 3017 | (byte-compile-set-symbol-position var)) | 3025 | (byte-compile-set-symbol-position bytecomp-var)) |
| 3018 | (if (or (not (symbolp var)) | 3026 | (if (or (not (symbolp bytecomp-var)) |
| 3019 | (byte-compile-const-symbol-p var (not (eq base-op 'byte-varref)))) | 3027 | (byte-compile-const-symbol-p bytecomp-var |
| 3028 | (not (eq base-op 'byte-varref)))) | ||
| 3020 | (byte-compile-warn | 3029 | (byte-compile-warn |
| 3021 | (cond ((eq base-op 'byte-varbind) "attempt to let-bind %s `%s'") | 3030 | (cond ((eq base-op 'byte-varbind) "attempt to let-bind %s `%s'") |
| 3022 | ((eq base-op 'byte-varset) "variable assignment to %s `%s'") | 3031 | ((eq base-op 'byte-varset) "variable assignment to %s `%s'") |
| 3023 | (t "variable reference to %s `%s'")) | 3032 | (t "variable reference to %s `%s'")) |
| 3024 | (if (symbolp var) "constant" "nonvariable") | 3033 | (if (symbolp bytecomp-var) "constant" "nonvariable") |
| 3025 | (prin1-to-string var)) | 3034 | (prin1-to-string bytecomp-var)) |
| 3026 | (and (get var 'byte-obsolete-variable) | 3035 | (and (get bytecomp-var 'byte-obsolete-variable) |
| 3027 | (not (eq var byte-compile-not-obsolete-var)) | 3036 | (not (eq bytecomp-var byte-compile-not-obsolete-var)) |
| 3028 | (byte-compile-warn-obsolete var)) | 3037 | (byte-compile-warn-obsolete bytecomp-var)) |
| 3029 | (if (byte-compile-warning-enabled-p 'free-vars) | 3038 | (if (byte-compile-warning-enabled-p 'free-vars) |
| 3030 | (if (eq base-op 'byte-varbind) | 3039 | (if (eq base-op 'byte-varbind) |
| 3031 | (push var byte-compile-bound-variables) | 3040 | (push bytecomp-var byte-compile-bound-variables) |
| 3032 | (or (boundp var) | 3041 | (or (boundp bytecomp-var) |
| 3033 | (memq var byte-compile-bound-variables) | 3042 | (memq bytecomp-var byte-compile-bound-variables) |
| 3034 | (if (eq base-op 'byte-varset) | 3043 | (if (eq base-op 'byte-varset) |
| 3035 | (or (memq var byte-compile-free-assignments) | 3044 | (or (memq bytecomp-var byte-compile-free-assignments) |
| 3036 | (progn | 3045 | (progn |
| 3037 | (byte-compile-warn "assignment to free variable `%s'" var) | 3046 | (byte-compile-warn "assignment to free variable `%s'" |
| 3038 | (push var byte-compile-free-assignments))) | 3047 | bytecomp-var) |
| 3039 | (or (memq var byte-compile-free-references) | 3048 | (push bytecomp-var byte-compile-free-assignments))) |
| 3049 | (or (memq bytecomp-var byte-compile-free-references) | ||
| 3040 | (progn | 3050 | (progn |
| 3041 | (byte-compile-warn "reference to free variable `%s'" var) | 3051 | (byte-compile-warn "reference to free variable `%s'" |
| 3042 | (push var byte-compile-free-references)))))))) | 3052 | bytecomp-var) |
| 3043 | (let ((tmp (assq var byte-compile-variables))) | 3053 | (push bytecomp-var byte-compile-free-references)))))))) |
| 3054 | (let ((tmp (assq bytecomp-var byte-compile-variables))) | ||
| 3044 | (unless tmp | 3055 | (unless tmp |
| 3045 | (setq tmp (list var)) | 3056 | (setq tmp (list bytecomp-var)) |
| 3046 | (push tmp byte-compile-variables)) | 3057 | (push tmp byte-compile-variables)) |
| 3047 | (byte-compile-out base-op tmp))) | 3058 | (byte-compile-out base-op tmp))) |
| 3048 | 3059 | ||
| @@ -3534,32 +3545,32 @@ That command is designed for interactive use only" fn)) | |||
| 3534 | (byte-defop-compiler-1 quote-form) | 3545 | (byte-defop-compiler-1 quote-form) |
| 3535 | 3546 | ||
| 3536 | (defun byte-compile-setq (form) | 3547 | (defun byte-compile-setq (form) |
| 3537 | (let ((args (cdr form))) | 3548 | (let ((bytecomp-args (cdr form))) |
| 3538 | (if args | 3549 | (if bytecomp-args |
| 3539 | (while args | 3550 | (while bytecomp-args |
| 3540 | (byte-compile-form (car (cdr args))) | 3551 | (byte-compile-form (car (cdr bytecomp-args))) |
| 3541 | (or for-effect (cdr (cdr args)) | 3552 | (or for-effect (cdr (cdr bytecomp-args)) |
| 3542 | (byte-compile-out 'byte-dup 0)) | 3553 | (byte-compile-out 'byte-dup 0)) |
| 3543 | (byte-compile-variable-ref 'byte-varset (car args)) | 3554 | (byte-compile-variable-ref 'byte-varset (car bytecomp-args)) |
| 3544 | (setq args (cdr (cdr args)))) | 3555 | (setq bytecomp-args (cdr (cdr bytecomp-args)))) |
| 3545 | ;; (setq), with no arguments. | 3556 | ;; (setq), with no arguments. |
| 3546 | (byte-compile-form nil for-effect)) | 3557 | (byte-compile-form nil for-effect)) |
| 3547 | (setq for-effect nil))) | 3558 | (setq for-effect nil))) |
| 3548 | 3559 | ||
| 3549 | (defun byte-compile-setq-default (form) | 3560 | (defun byte-compile-setq-default (form) |
| 3550 | (let ((args (cdr form)) | 3561 | (let ((bytecomp-args (cdr form)) |
| 3551 | setters) | 3562 | setters) |
| 3552 | (while args | 3563 | (while bytecomp-args |
| 3553 | (let ((var (car args))) | 3564 | (let ((var (car bytecomp-args))) |
| 3554 | (if (or (not (symbolp var)) | 3565 | (if (or (not (symbolp var)) |
| 3555 | (byte-compile-const-symbol-p var t)) | 3566 | (byte-compile-const-symbol-p var t)) |
| 3556 | (byte-compile-warn | 3567 | (byte-compile-warn |
| 3557 | "variable assignment to %s `%s'" | 3568 | "variable assignment to %s `%s'" |
| 3558 | (if (symbolp var) "constant" "nonvariable") | 3569 | (if (symbolp var) "constant" "nonvariable") |
| 3559 | (prin1-to-string var))) | 3570 | (prin1-to-string var))) |
| 3560 | (push (list 'set-default (list 'quote var) (car (cdr args))) | 3571 | (push (list 'set-default (list 'quote var) (car (cdr bytecomp-args))) |
| 3561 | setters)) | 3572 | setters)) |
| 3562 | (setq args (cdr (cdr args)))) | 3573 | (setq bytecomp-args (cdr (cdr bytecomp-args)))) |
| 3563 | (byte-compile-form (cons 'progn (nreverse setters))))) | 3574 | (byte-compile-form (cons 'progn (nreverse setters))))) |
| 3564 | 3575 | ||
| 3565 | (defun byte-compile-quote (form) | 3576 | (defun byte-compile-quote (form) |
| @@ -3571,14 +3582,14 @@ That command is designed for interactive use only" fn)) | |||
| 3571 | 3582 | ||
| 3572 | ;;; control structures | 3583 | ;;; control structures |
| 3573 | 3584 | ||
| 3574 | (defun byte-compile-body (body &optional for-effect) | 3585 | (defun byte-compile-body (bytecomp-body &optional for-effect) |
| 3575 | (while (cdr body) | 3586 | (while (cdr bytecomp-body) |
| 3576 | (byte-compile-form (car body) t) | 3587 | (byte-compile-form (car bytecomp-body) t) |
| 3577 | (setq body (cdr body))) | 3588 | (setq bytecomp-body (cdr bytecomp-body))) |
| 3578 | (byte-compile-form (car body) for-effect)) | 3589 | (byte-compile-form (car bytecomp-body) for-effect)) |
| 3579 | 3590 | ||
| 3580 | (defsubst byte-compile-body-do-effect (body) | 3591 | (defsubst byte-compile-body-do-effect (bytecomp-body) |
| 3581 | (byte-compile-body body for-effect) | 3592 | (byte-compile-body bytecomp-body for-effect) |
| 3582 | (setq for-effect nil)) | 3593 | (setq for-effect nil)) |
| 3583 | 3594 | ||
| 3584 | (defsubst byte-compile-form-do-effect (form) | 3595 | (defsubst byte-compile-form-do-effect (form) |
| @@ -3741,10 +3752,10 @@ that suppresses all warnings during execution of BODY." | |||
| 3741 | 3752 | ||
| 3742 | (defun byte-compile-and (form) | 3753 | (defun byte-compile-and (form) |
| 3743 | (let ((failtag (byte-compile-make-tag)) | 3754 | (let ((failtag (byte-compile-make-tag)) |
| 3744 | (args (cdr form))) | 3755 | (bytecomp-args (cdr form))) |
| 3745 | (if (null args) | 3756 | (if (null bytecomp-args) |
| 3746 | (byte-compile-form-do-effect t) | 3757 | (byte-compile-form-do-effect t) |
| 3747 | (byte-compile-and-recursion args failtag)))) | 3758 | (byte-compile-and-recursion bytecomp-args failtag)))) |
| 3748 | 3759 | ||
| 3749 | ;; Handle compilation of a nontrivial `and' call. | 3760 | ;; Handle compilation of a nontrivial `and' call. |
| 3750 | ;; We use tail recursion so we can use byte-compile-maybe-guarded. | 3761 | ;; We use tail recursion so we can use byte-compile-maybe-guarded. |
| @@ -3760,10 +3771,10 @@ that suppresses all warnings during execution of BODY." | |||
| 3760 | 3771 | ||
| 3761 | (defun byte-compile-or (form) | 3772 | (defun byte-compile-or (form) |
| 3762 | (let ((wintag (byte-compile-make-tag)) | 3773 | (let ((wintag (byte-compile-make-tag)) |
| 3763 | (args (cdr form))) | 3774 | (bytecomp-args (cdr form))) |
| 3764 | (if (null args) | 3775 | (if (null bytecomp-args) |
| 3765 | (byte-compile-form-do-effect nil) | 3776 | (byte-compile-form-do-effect nil) |
| 3766 | (byte-compile-or-recursion args wintag)))) | 3777 | (byte-compile-or-recursion bytecomp-args wintag)))) |
| 3767 | 3778 | ||
| 3768 | ;; Handle compilation of a nontrivial `or' call. | 3779 | ;; Handle compilation of a nontrivial `or' call. |
| 3769 | ;; We use tail recursion so we can use byte-compile-maybe-guarded. | 3780 | ;; We use tail recursion so we can use byte-compile-maybe-guarded. |
| @@ -4328,7 +4339,7 @@ already up-to-date." | |||
| 4328 | (defvar command-line-args-left) ;Avoid 'free variable' warning | 4339 | (defvar command-line-args-left) ;Avoid 'free variable' warning |
| 4329 | (if (not noninteractive) | 4340 | (if (not noninteractive) |
| 4330 | (error "`batch-byte-compile' is to be used only with -batch")) | 4341 | (error "`batch-byte-compile' is to be used only with -batch")) |
| 4331 | (let ((error nil)) | 4342 | (let ((bytecomp-error nil)) |
| 4332 | (while command-line-args-left | 4343 | (while command-line-args-left |
| 4333 | (if (file-directory-p (expand-file-name (car command-line-args-left))) | 4344 | (if (file-directory-p (expand-file-name (car command-line-args-left))) |
| 4334 | ;; Directory as argument. | 4345 | ;; Directory as argument. |
| @@ -4345,7 +4356,7 @@ already up-to-date." | |||
| 4345 | (file-exists-p bytecomp-dest) | 4356 | (file-exists-p bytecomp-dest) |
| 4346 | (file-newer-than-file-p bytecomp-source bytecomp-dest)) | 4357 | (file-newer-than-file-p bytecomp-source bytecomp-dest)) |
| 4347 | (if (null (batch-byte-compile-file bytecomp-source)) | 4358 | (if (null (batch-byte-compile-file bytecomp-source)) |
| 4348 | (setq error t))))) | 4359 | (setq bytecomp-error t))))) |
| 4349 | ;; Specific file argument | 4360 | ;; Specific file argument |
| 4350 | (if (or (not noforce) | 4361 | (if (or (not noforce) |
| 4351 | (let* ((bytecomp-source (car command-line-args-left)) | 4362 | (let* ((bytecomp-source (car command-line-args-left)) |
| @@ -4353,9 +4364,9 @@ already up-to-date." | |||
| 4353 | (or (not (file-exists-p bytecomp-dest)) | 4364 | (or (not (file-exists-p bytecomp-dest)) |
| 4354 | (file-newer-than-file-p bytecomp-source bytecomp-dest)))) | 4365 | (file-newer-than-file-p bytecomp-source bytecomp-dest)))) |
| 4355 | (if (null (batch-byte-compile-file (car command-line-args-left))) | 4366 | (if (null (batch-byte-compile-file (car command-line-args-left))) |
| 4356 | (setq error t)))) | 4367 | (setq bytecomp-error t)))) |
| 4357 | (setq command-line-args-left (cdr command-line-args-left))) | 4368 | (setq command-line-args-left (cdr command-line-args-left))) |
| 4358 | (kill-emacs (if error 1 0)))) | 4369 | (kill-emacs (if bytecomp-error 1 0)))) |
| 4359 | 4370 | ||
| 4360 | (defun batch-byte-compile-file (bytecomp-file) | 4371 | (defun batch-byte-compile-file (bytecomp-file) |
| 4361 | (if debug-on-error | 4372 | (if debug-on-error |