X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdefboot.lisp;h=f05fb0a8f104ba3ab49b9b7ace78a304020a8762;hb=f8893c7c658bf9d9e0757c63e47af2fdea810f04;hp=2379081aada5f6ae40a24a599d7f378a8cf082be;hpb=c41cb4c87eae7b04f844dca5f7edb5086c5d2d68;p=sbcl.git diff --git a/src/code/defboot.lisp b/src/code/defboot.lisp index 2379081..f05fb0a 100644 --- a/src/code/defboot.lisp +++ b/src/code/defboot.lisp @@ -285,14 +285,14 @@ (defmacro-mundanely dotimes ((var count &optional (result nil)) &body body) (cond ((numberp count) `(do ((,var 0 (1+ ,var))) - ((>= ,var ,count) ,result) - (declare (type unsigned-byte ,var)) - ,@body)) + ((>= ,var ,count) ,result) + (declare (type unsigned-byte ,var)) + ,@body)) (t (let ((v1 (gensym))) `(do ((,var 0 (1+ ,var)) (,v1 ,count)) - ((>= ,var ,v1) ,result) - (declare (type unsigned-byte ,var)) - ,@body))))) + ((>= ,var ,v1) ,result) + (declare (type unsigned-byte ,var)) + ,@body))))) (defmacro-mundanely dolist ((var list &optional (result nil)) &body body) ;; We repeatedly bind the var instead of setting it so that we never @@ -304,18 +304,23 @@ ;; since we don't want to use IGNORABLE on what might be a special ;; var. (multiple-value-bind (forms decls) (parse-body body :doc-string-allowed nil) - (let ((n-list (gensym))) - `(do* ((,n-list ,list (cdr ,n-list))) - ((endp ,n-list) - ,@(if result - `((let ((,var nil)) - ,var - ,result)) - '(nil))) - (let ((,var (car ,n-list))) - ,@decls - (tagbody - ,@forms)))))) + (let ((n-list (gensym "N-LIST")) + (start (gensym "START"))) + `(block nil + (let ((,n-list ,list)) + (tagbody + ,start + (unless (endp ,n-list) + (let ((,var (car ,n-list))) + ,@decls + (setq ,n-list (cdr ,n-list)) + (tagbody ,@forms)) + (go ,start)))) + ,(if result + `(let ((,var nil)) + ,var + ,result) + nil))))) ;;;; conditions, handlers, restarts @@ -383,7 +388,7 @@ ,n-cond (car *restart-clusters*) ,(if (eq name 'cerror) - `(cerror ,(second expression) ,n-cond) + `(cerror ,(second exp) ,n-cond) `(,name ,n-cond)))) expression)) expression)))