~ chicken-r7rs (master) 091911d32921985c940ed24814049a8b7840617e


commit 091911d32921985c940ed24814049a8b7840617e
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Tue Apr 26 10:09:08 2016 +1200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Tue Apr 26 10:09:12 2016 +1200

    Fix expansion of `include-library-declarations`
    
    Previously, it would incorrectly splice a "##core#begin" into the
    expansion.
    
    Also, drop the unnecessary "##core#begin" from the "##core#module" forms
    that result from `define-library` expansions.

diff --git a/r7rs-compile-time.scm b/r7rs-compile-time.scm
index b18a51e..1cc707b 100644
--- a/r7rs-compile-time.scm
+++ b/r7rs-compile-time.scm
@@ -146,7 +146,7 @@
 	      ,(parse-decls more)))
 	   ((('include-library-declarations fnames ...) . more)
 	    `(##core#begin
-	      ,@(process-include-decls fnames)
+	      ,(process-include-decls fnames)
 	      ,(parse-decls more)))
 	   ((('cond-expand decls ...) . more)
 	    `(##core#begin
@@ -157,17 +157,16 @@
 	      ,@code
 	      ,(parse-decls more)))
 	   (decl (syntax-error 'define-library "invalid library declaration" decl))))
-       `(##core#begin
-	 (##core#module
-	  ,real-name ((,dummy-export))
-	  ;; gruesome hack: we add a dummy export for adding indirect exports
-	  (##core#define-syntax ,dummy-export (##core#lambda _ '(##core#undefined)))
-	  ;; Another gruesome hack: provide feature so "use" works properly
-	  (##sys#provide (##core#quote ,real-name))
-	  ;; Set up an R7RS environment for the module's body.
-	  (import-for-syntax r7rs) ; overwrites "syntax-rules"
-	  (import r7rs) ; overwrites existing "import" and "import-for-syntax"
-          ,(parse-decls decls)))))
+       `(##core#module
+         ,real-name ((,dummy-export))
+         ;; gruesome hack: we add a dummy export for adding indirect exports
+         (##core#define-syntax ,dummy-export (##core#lambda _ '(##core#undefined)))
+         ;; Another gruesome hack: provide feature so "use" works properly
+         (##sys#provide (##core#quote ,real-name))
+         ;; Set up an R7RS environment for the module's body.
+         (import-for-syntax r7rs) ; overwrites "syntax-rules"
+         (import r7rs) ; overwrites existing "import" and "import-for-syntax"
+         ,(parse-decls decls))))
     (_ (syntax-error 'define-library "invalid library definition" form))))
 
 (define (register-r7rs-module name)
Trap