(`(,(pred byte-code-function-p) . ,exps)
(cons fn (mapcar #'byte-optimize-form exps)))
- (`(,(pred (not symbolp)) . ,_)
- (byte-compile-warn-x form "`%s' is a malformed function" fn)
- form)
-
((guard (when for-effect
(if-let ((tmp (byte-opt--fget fn 'side-effect-free)))
(or byte-compile-delete-errors
(byte-optimize-form form for-effect)))
(defun byte-optimize-form (form &optional for-effect)
- (push form byte-compile-form-stack)
(while
(progn
;; First, optimize all sub-forms of this one.
(byte-compile-log " %s\t==>\t%s" old new)
(setq form new)
(not (eq new old))))))))
- (pop byte-compile-form-stack)
form)
(defun byte-optimize--rename-var-body (var new-var body)
(cconv-convert exp env extend))
(`(,func . ,forms)
- ;; First element is function or whatever function-like forms are: or, and,
- ;; if, catch, progn, prog1, while, until
- `(,func . ,(mapcar (lambda (form)
- (cconv-convert form env extend))
- forms)))
+ (if (symbolp func)
+ ;; First element is function or whatever function-like forms are:
+ ;; or, and, if, catch, progn, prog1, while, until
+ `(,func . ,(mapcar (lambda (form)
+ (cconv-convert form env extend))
+ forms))
+ (macroexp--warn-wrap form (format-message "Malformed function `%S'"
+ (car form))
+ nil nil)))
(_ (or (cdr (assq form env)) form))))