mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Added lib:rename-exports, made lib:exports handle renames
This commit is contained in:
parent
1a6469fedf
commit
7d9aae56d8
1 changed files with 15 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
|||
lib:name->symbol
|
||||
lib:result
|
||||
lib:exports
|
||||
lib:rename-exports
|
||||
lib:imports
|
||||
lib:body
|
||||
lib:includes
|
||||
|
@ -80,10 +81,23 @@
|
|||
;; TODO: most of these below assume 0 or 1 instances of the directive.
|
||||
;; may need to replace some of these later with filter operations to
|
||||
;; support more than 1 instance.
|
||||
(define (lib:exports ast)
|
||||
(define (lib:raw-exports ast)
|
||||
(lib:result
|
||||
(let ((code (assoc 'export (cddr ast))))
|
||||
(if code (cdr code) #f))))
|
||||
(define (lib:rename-exports ast)
|
||||
(filter
|
||||
(lambda (ex)
|
||||
(tagged-list? 'rename ex))
|
||||
(lib:raw-exports ast)))
|
||||
(define (lib:exports ast)
|
||||
(map
|
||||
(lambda (ex)
|
||||
;; Replace any renamed exports
|
||||
(if (tagged-list? 'rename ex)
|
||||
(caddr ex)
|
||||
ex))
|
||||
(lib:raw-exports ast)))
|
||||
(define (lib:imports ast)
|
||||
(lib:result
|
||||
(let ((code (assoc 'import (cddr ast))))
|
||||
|
|
Loading…
Add table
Reference in a new issue