Changeset 4200 for trunk/lisp/emacs-lisp/byte-opt.el
- Timestamp:
- 04/07/07 15:49:28 (2 years ago)
- Files:
-
- trunk/lisp/emacs-lisp/byte-opt.el (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lisp/emacs-lisp/byte-opt.el
r4190 r4200 535 535 ;; Detect the expansion of (pop foo). 536 536 ;; There is no need to compile the call to `car' there. 537 (progn (setq foo (list form fn)) nil) 537 538 (and (eq fn 'car) 538 539 (eq (car-safe (cadr form)) 'prog1) … … 546 547 (eq (cadr (nth 2 last)) var)))) 547 548 (progn 548 (byte-compile-warn "value returned by `%s' is notused"549 (prin1-to-string (car form)))549 (byte-compile-warn "value returned from %s is unused" 550 (prin1-to-string form)) 550 551 nil))) 551 552 (byte-compile-log " %s called for effect; deleted" fn) … … 1117 1118 (byte-optimize-predicate form)) 1118 1119 form)) 1119 1120 (put 'concat 'byte-optimizer 'byte-optimize-pure-func)1121 (put 'symbol-name 'byte-optimizer 'byte-optimize-pure-func)1122 (put 'regexp-opt 'byte-optimizer 'byte-optimize-pure-func)1123 (put 'regexp-quote 'byte-optimizer 'byte-optimize-pure-func)1124 (put 'string-to-syntax 'byte-optimizer 'byte-optimize-pure-func)1125 (defun byte-optimize-pure-func (form)1126 "Do constant folding for pure functions.1127 This assumes that the function will not have any side-effects and that1128 its return value depends solely on its arguments.1129 If the function can signal an error, this might change the semantics1130 of FORM by signaling the error at compile-time."1131 (let ((args (cdr form))1132 (constant t))1133 (while (and args constant)1134 (or (byte-compile-constp (car args))1135 (setq constant nil))1136 (setq args (cdr args)))1137 (if constant1138 (list 'quote (eval form))1139 form)))1140 1120 1141 1121 ;; Avoid having to write forward-... with a negative arg for speed.
