Commit 66ff2893 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(byte-optimize-set): New. Turn `set' into `setq' when applicable.

parent 999e6484
......@@ -1168,6 +1168,18 @@
(if (equal '((quote xemacs)) (cdr-safe form))
(put 'set 'byte-optimizer 'byte-optimize-set)
(defun byte-optimize-set (form)
(let ((var (car-safe (cdr-safe form))))
((and (eq (car-safe var) 'quote) (consp (cdr var)))
(list* 'setq (cadr var) (cddr form)))
((and (eq (car-safe var) 'make-local-variable)
(eq (car-safe (setq var (car-safe (cdr var)))) 'quote)
(consp (cdr var)))
`(progn ,(cadr form) (setq ,(cadr var) ,@(cddr form))))
(t form))))
;;; enumerating those functions which need not be called if the returned
;;; value is not used. That is, something like
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment