X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcode%2Fdefboot.lisp;h=c505819bd5c80ba000cf4bef391862e64b2055ec;hb=e67cc0f952040723f7d0f37ddb88fe895f4b1464;hp=8a8e9a3427f56270e5e40a2d05caad65f9bbf9d9;hpb=bea5b384106a6734a4b280a76e8ebdd4d51b5323;p=sbcl.git diff --git a/src/code/defboot.lisp b/src/code/defboot.lisp index 8a8e9a3..c505819 100644 --- a/src/code/defboot.lisp +++ b/src/code/defboot.lisp @@ -314,6 +314,16 @@ (declare (type unsigned-byte ,var)) ,@body))))) +(defun filter-dolist-declarations (decls) + (mapcar (lambda (decl) + `(declare ,@(remove-if + (lambda (clause) + (and (consp clause) + (or (eq (car clause) 'type) + (eq (car clause) 'ignore)))) + (cdr decl)))) + decls)) + (defmacro-mundanely dolist ((var list &optional (result nil)) &body body) ;; We repeatedly bind the var instead of setting it so that we never ;; have to give the var an arbitrary value such as NIL (which might @@ -338,6 +348,11 @@ (go ,start)))) ,(if result `(let ((,var nil)) + ;; Filter out TYPE declarations (VAR gets bound to NIL, + ;; and might have a conflicting type declaration) and + ;; IGNORE (VAR might be ignored in the loop body, but + ;; it's used in the result form). + ,@(filter-dolist-declarations decls) ,var ,result) nil)))))