From 81a47b764ffd676e72d21927df058376d006fa34 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Thu, 16 Aug 1990 16:26:04 +0000
Subject: [PATCH] Added code to CONVERT-AND-MAYBE-COMPILER to place the current
 value of *DEFAULT-COOKIE* in the *LEXICAL-ENVIRONMENT* so that the global
 value takes effect within that form even if it is different than the one in
 effect at the start of the compilation. In PROCESS-FORM, fixed the processing
 of package-frobbing forms to stop out-of-order execution problems.

---
 compiler/main.lisp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/compiler/main.lisp b/compiler/main.lisp
index 4c8c532cc..bb40fba11 100644
--- a/compiler/main.lisp
+++ b/compiler/main.lisp
@@ -682,10 +682,16 @@
 ;;; compile something.  If *BLOCK-COMPILE* is true, then we still convert the
 ;;; form, but delay compilation, pushing the result on *TOP-LEVEL-LAMBDAS*
 ;;; instead.
+;;;
+;;;   The *DEFAULT-COOKIE* at this time becomes the default policy for
+;;; compiling the form.  Any enclosed PROCLAIMs will affect only subsequent
+;;; forms.
 ;;; 
 (defun convert-and-maybe-compile (form path object)
   (declare (list path) (type object object))
-  (let ((tll (ir1-top-level form path nil)))
+  (let* ((*lexical-environment*
+	  (make-lexenv :cookie *default-cookie*))
+	 (tll (ir1-top-level form path nil)))
     (cond (*block-compile* (push tll *top-level-lambdas*))
 	  (t
 	   (compile-top-level (list tll) object)
@@ -755,8 +761,11 @@
 			   unexport use-package unuse-package import)
 	     (eval form)
 	     (etypecase object
-	       (fasl-file (fasl-dump-cold-load-form form object))
-	       ((or null core-object))))
+	       (fasl-file
+		(compile-top-level-lambdas () t object)
+		(fasl-dump-cold-load-form form object))
+	       ((or null core-object)
+		(convert-and-maybe-compile form path object))))
 	    ((eval-when)
 	     (unless (>= (length form) 2)
 	       (compiler-error "EVAL-WHEN form is too short: ~S." form))
-- 
GitLab