comparison lisp/emacs-lisp/bytecomp.el @ 84736:247a13281cd8

Markus Triska <markus.triska at gmx.at> (byte-compile-normal-call): Warn when `mapcar' is called for effect.
author Glenn Morris <rgm@gnu.org>
date Fri, 21 Sep 2007 04:24:18 +0000
parents 5ee0e4e08f91
children 246290585e1b
comparison
equal deleted inserted replaced
84735:7d321919d0e7 84736:247a13281cd8
2829 (byte-compile-discard))) 2829 (byte-compile-discard)))
2830 2830
2831 (defun byte-compile-normal-call (form) 2831 (defun byte-compile-normal-call (form)
2832 (if byte-compile-generate-call-tree 2832 (if byte-compile-generate-call-tree
2833 (byte-compile-annotate-call-tree form)) 2833 (byte-compile-annotate-call-tree form))
2834 (when (and for-effect (eq (car form) 'mapcar))
2835 (byte-compile-set-symbol-position 'mapcar)
2836 (byte-compile-warn
2837 "`mapcar' called for effect; use `mapc' or `dolist' instead"))
2834 (byte-compile-push-constant (car form)) 2838 (byte-compile-push-constant (car form))
2835 (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster. 2839 (mapc 'byte-compile-form (cdr form)) ; wasteful, but faster.
2836 (byte-compile-out 'byte-call (length (cdr form)))) 2840 (byte-compile-out 'byte-call (length (cdr form))))
2837 2841
2838 (defun byte-compile-variable-ref (base-op var) 2842 (defun byte-compile-variable-ref (base-op var)