summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-08-29 06:20:21 +0000
committerRichard M. Stallman <rms@gnu.org>1996-08-29 06:20:21 +0000
commit10809e0f111386830566b03718b4e01a209f3ac3 (patch)
treef584e40d85f95b51915c408e3bbfca02bb72cdc0 /lisp/emacs-lisp/bytecomp.el
parent3f7e952d9a2c795595d1de392a42e527a31c4872 (diff)
downloademacs-10809e0f111386830566b03718b4e01a209f3ac3.tar.gz
emacs-10809e0f111386830566b03718b4e01a209f3ac3.tar.bz2
emacs-10809e0f111386830566b03718b4e01a209f3ac3.zip
(byte-compile-associative): Treat one arg case like (+ x 0).
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 682771c97cb..d2a22915067 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -10,7 +10,7 @@
;;; This version incorporates changes up to version 2.10 of the
;;; Zawinski-Furuseth compiler.
-(defconst byte-compile-version "$Revision: 2.15 $")
+(defconst byte-compile-version "$Revision: 2.16 $")
;; This file is part of GNU Emacs.
@@ -2473,12 +2473,16 @@ If FORM is a lambda or a macro, byte-compile it as a function."
;; Compile a function that accepts one or more args and is right-associative.
;; We do it by left-associativity so that the operations
;; are done in the same order as in interpreted code.
+;; We treat the one-arg case, as in (+ x), like (+ x 0).
+;; in order to convert markers to numbers, and trigger expected errors.
(defun byte-compile-associative (form)
(if (cdr form)
(let ((opcode (get (car form) 'byte-opcode))
(args (copy-sequence (cdr form))))
(byte-compile-form (car args))
(setq args (cdr args))
+ (or args (setq args '(0)
+ opcode (get '+ 'byte-opcode)))
(while args
(byte-compile-form (car args))
(byte-compile-out opcode 0)