mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 22:59:16 +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))
|
||||
(body (cddr expr)))
|
||||
`(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* '())
|
||||
,@body
|
||||
(set! *this-module* (reverse *this-module*))
|
||||
(let ((exports
|
||||
(cond ((assq 'export *this-module*) => cdr)
|
||||
(cond ((assq 'export *this-module*)
|
||||
=> (lambda (x) (map rewrite-export (cdr x))))
|
||||
(else '()))))
|
||||
(set! *modules*
|
||||
(cons (cons ',name (make-module exports #f *this-module*))
|
||||
|
|
Loading…
Add table
Reference in a new issue