summaryrefslogtreecommitdiff
path: root/module/language/scheme/compile-ghil.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2009-02-09 11:50:58 +0100
committerAndy Wingo <wingo@pobox.com>2009-02-09 11:50:58 +0100
commit277f728b14c96108b4ef6fb6085a38cc31bb61e5 (patch)
treed4d2f6a34c58098268e314b413a185cc275c3c08 /module/language/scheme/compile-ghil.scm
parent989228796043917ad4d445049dc10948ae75853d (diff)
downloadguile-277f728b14c96108b4ef6fb6085a38cc31bb61e5.tar.gz
allow defmacros to unquote in macros into expanded expressions
* module/language/scheme/compile-ghil.scm (lookup-transformer): Allow macros to be unquoted into the car of any form that results from macro expansion. This lets modules export defmacros built on other defmacros that are not exported.
Diffstat (limited to 'module/language/scheme/compile-ghil.scm')
-rw-r--r--module/language/scheme/compile-ghil.scm17
1 files changed, 11 insertions, 6 deletions
diff --git a/module/language/scheme/compile-ghil.scm b/module/language/scheme/compile-ghil.scm
index 9376be48c..df38fbb83 100644
--- a/module/language/scheme/compile-ghil.scm
+++ b/module/language/scheme/compile-ghil.scm
@@ -89,12 +89,17 @@
;; FIXME shadowing lexicals?
(define (lookup-transformer head retrans)
(let* ((mod (current-module))
- (val (and (symbol? head)
- (and=> (module-variable mod head)
- (lambda (var)
- ;; unbound vars can happen if the module
- ;; definition forward-declared them
- (and (variable-bound? var) (variable-ref var)))))))
+ (val (cond
+ ((symbol? head)
+ (and=> (module-variable mod head)
+ (lambda (var)
+ ;; unbound vars can happen if the module
+ ;; definition forward-declared them
+ (and (variable-bound? var) (variable-ref var)))))
+ ;; allow macros to be unquoted into the output of a macro
+ ;; expansion
+ ((macro? head) head)
+ (else #f))))
(cond
((hashq-ref *translate-table* val))