aboutsummaryrefslogtreecommitdiffstats
path: root/lib/csc/macros.csc
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2022-08-07 19:42:35 -0700
committerRose Hogenson <rhogenson@posteo.net>2022-08-07 19:42:35 -0700
commitb81426bb210ea5fca6d841e4dfeb38d83e1a6554 (patch)
treec8f0f5c164dbf7d54eeb05246f23de38258d2382 /lib/csc/macros.csc
parentAdd a needed import to 10-define.csc. (diff)
downloadchromatopelma-b81426bb210ea5fca6d841e4dfeb38d83e1a6554.tar.zst
Misc test fixup in the compiler.
Diffstat (limited to 'lib/csc/macros.csc')
-rw-r--r--lib/csc/macros.csc23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/csc/macros.csc b/lib/csc/macros.csc
index 4463f91..739f532 100644
--- a/lib/csc/macros.csc
+++ b/lib/csc/macros.csc
@@ -837,14 +837,15 @@
(set! ident-map (insert ident-map k v)))
env)
(define environment (make-environment ident-map name))
- (loop for expr in body
- for expanded-expr = (expand expr environment)
- with res = (make-constant #f)
- do (set! res (make-sequence res expanded-expr))
- finally (return res)
- if (define-syntax? expanded-expr)
- do (set! environment
- (add-binding
- (define-syntax-name expanded-expr)
- (define-syntax-transformer expanded-expr)
- environment))))))
+ (if (null? body)
+ (make-constant #f)
+ (loop for expr in body
+ for expanded-expr = (expand expr environment)
+ for res = expanded-expr then (make-sequence res expanded-expr)
+ finally (return res)
+ if (define-syntax? expanded-expr)
+ do (set! environment
+ (add-binding
+ (define-syntax-name expanded-expr)
+ (define-syntax-transformer expanded-expr)
+ environment)))))))