mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-24 04:25:08 +02:00
Allowing rename exports.
This commit is contained in:
parent
92cae4e8b8
commit
5c33a39d4b
1 changed files with 9 additions and 1 deletions
|
@ -140,11 +140,19 @@
|
||||||
(let ((name (cadr expr))
|
(let ((name (cadr expr))
|
||||||
(body (cddr expr)))
|
(body (cddr expr)))
|
||||||
`(let ((tmp *this-module*))
|
`(let ((tmp *this-module*))
|
||||||
|
(define (rewrite-export x)
|
||||||
|
(if (pair? x)
|
||||||
|
(if (and (= 3 (length x))
|
||||||
|
(eq? 'rename (identifier->symbol (car x))))
|
||||||
|
(cons (caddr x) (cadr x))
|
||||||
|
(error "invalid module export" x))
|
||||||
|
x))
|
||||||
(set! *this-module* '())
|
(set! *this-module* '())
|
||||||
,@body
|
,@body
|
||||||
(set! *this-module* (reverse *this-module*))
|
(set! *this-module* (reverse *this-module*))
|
||||||
(let ((exports
|
(let ((exports
|
||||||
(cond ((assq 'export *this-module*) => cdr)
|
(cond ((assq 'export *this-module*)
|
||||||
|
=> (lambda (x) (map rewrite-export (cdr x))))
|
||||||
(else '()))))
|
(else '()))))
|
||||||
(set! *modules*
|
(set! *modules*
|
||||||
(cons (cons ',name (make-module exports #f *this-module*))
|
(cons (cons ',name (make-module exports #f *this-module*))
|
||||||
|
|
Loading…
Add table
Reference in a new issue