Fix unsyntaxing of open-blocks and block-declarations.
authorJoe Marshall <eval.apply@gmail.com>
Mon, 21 May 2012 18:24:38 +0000 (11:24 -0700)
committerJoe Marshall <eval.apply@gmail.com>
Mon, 21 May 2012 18:24:38 +0000 (11:24 -0700)
src/runtime/unsyn.scm

index 1aa2927083ea48a2390784ec38848d90c0a3c2b9..472776f9b1ace7812119e80f1fc21258c0722650 100644 (file)
@@ -199,7 +199,13 @@ USA.
       `(LOCAL-DECLARE ,text ,(unsyntax-object expression)))))
 
 (define (unsyntax-SEQUENCE-object seq)
-  `(BEGIN ,@(unsyntax-sequence-actions seq)))
+  (let ((first-action (sequence-immediate-first seq)))
+    (if (block-declaration? first-action)
+       `(BEGIN
+         (DECLARE ,@(block-declaration-text first-action))
+         ,@(unsyntax-sequence (sequence-immediate-second seq)))
+       `(BEGIN
+         ,@(unsyntax-sequence-actions seq)))))
 
 (define (unsyntax-sequence seq)
   (if (sequence? seq)
@@ -227,9 +233,7 @@ USA.
   (if (eq? #t unsyntaxer:macroize?)
       (open-block-components open-block
        (lambda (auxiliary declarations expression)
-         `(OPEN-BLOCK ,auxiliary
-                      ,declarations
-                      ,@(unsyntax-sequence expression))))
+         (unsyntax-object (unscan-defines auxiliary declarations expression))))
       (unsyntax-SEQUENCE-object open-block)))
 
 (define (unsyntax-DELAY-object object)