mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Issue #412 - Fix expand within a cond-expand
Allow these dependencies to be recognized by Cyclone.
This commit is contained in:
parent
f0bf9fc1d4
commit
6a1377178a
5 changed files with 22 additions and 17 deletions
|
@ -5,6 +5,9 @@
|
|||
Bug Fixes
|
||||
|
||||
- The compiler now displays a helpful error message to the user when compilation of a program fails due to an error building a dependent library.
|
||||
- Enhanced `cond-expand` support in a library declaration to
|
||||
- Properly handle cases where there is more than one `cond-expand` sub-expression. EG: two `begin` expressions, a `begin` / `import`, etc.
|
||||
- Properly handle the case where `export` is defined by `cond-expand`. Previously such exports would not be recognized by code importing the library.
|
||||
|
||||
## 0.21 - September 17, 2020
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@
|
|||
(report:elapsed "imports:")
|
||||
(trace:info "imports:")
|
||||
(trace:info imports)
|
||||
(set! imported-vars (lib:imports->idb imports append-dirs prepend-dirs))
|
||||
(set! imported-vars (lib:imports->idb imports append-dirs prepend-dirs (base-expander)))
|
||||
(report:elapsed "resolved imports:")
|
||||
(trace:info "resolved imports:")
|
||||
(trace:info imported-vars)
|
||||
|
@ -245,7 +245,7 @@
|
|||
(set! imports (append imports (car program:imports/code)))
|
||||
(trace:info "imports:")
|
||||
(trace:info imports)
|
||||
(set! imported-vars (lib:imports->idb imports append-dirs prepend-dirs))
|
||||
(set! imported-vars (lib:imports->idb imports append-dirs prepend-dirs (base-expander)))
|
||||
(report:elapsed "resolved imports:")
|
||||
(trace:info "resolved imports:")
|
||||
(trace:info imported-vars)
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
; Example from draft 6 of R7RS
|
||||
(define-library (example grid)
|
||||
(cond-expand
|
||||
(cyclone
|
||||
(export make rows cols ref each
|
||||
put!) ;(rename put! set!))
|
||||
))
|
||||
(import (scheme base))
|
||||
(begin
|
||||
;; Create an NxM grid.
|
||||
|
|
|
@ -1,21 +1,17 @@
|
|||
(define-library (example life)
|
||||
(import (except (scheme base) set!)
|
||||
; (scheme write)
|
||||
; (example grid)
|
||||
)
|
||||
(import (except (scheme base) set!))
|
||||
(cond-expand
|
||||
(cyclone
|
||||
(import (scheme write))
|
||||
; ))
|
||||
; (cond-expand
|
||||
; (cyclone
|
||||
(import (example grid))
|
||||
))
|
||||
|
||||
))
|
||||
|
||||
;(cond-expand
|
||||
; (cyclone
|
||||
(cond-expand
|
||||
(cyclone
|
||||
(export life)
|
||||
;))
|
||||
))
|
||||
|
||||
(cond-expand
|
||||
(cyclone
|
||||
(begin
|
||||
|
|
|
@ -440,12 +440,15 @@
|
|||
" "))
|
||||
|
||||
;; Read export list for a given import
|
||||
(define (lib:import->export-list import append-dirs prepend-dirs)
|
||||
(define (lib:import->export-list import append-dirs prepend-dirs expander)
|
||||
(let* ((lib-name (lib:import->library-name import))
|
||||
(dir (string-append (lib:import->filename lib-name ".sld" append-dirs prepend-dirs)))
|
||||
(fp (open-input-file dir))
|
||||
(lib (read-all fp))
|
||||
(exports (lib:exports (car lib))))
|
||||
(lib* (if expander
|
||||
(list (lib:cond-expand (car lib) expander))
|
||||
lib))
|
||||
(exports (lib:exports (car lib*))))
|
||||
(close-input-port fp)
|
||||
(lib:import-set/exports->imports import exports)))
|
||||
|
||||
|
@ -551,7 +554,7 @@
|
|||
;;
|
||||
;; TODO: convert this to use a hashtable. Initially a-lists
|
||||
;; will be used to prove out the concept, but this is inefficient
|
||||
(define (lib:imports->idb imports append-dirs prepend-dirs)
|
||||
(define (lib:imports->idb imports append-dirs prepend-dirs expander)
|
||||
(apply
|
||||
append
|
||||
(map
|
||||
|
@ -563,7 +566,7 @@
|
|||
(cons id lib-name)
|
||||
ids))
|
||||
'()
|
||||
(lib:import->export-list import-set append-dirs prepend-dirs))))
|
||||
(lib:import->export-list import-set append-dirs prepend-dirs expander))))
|
||||
(map lib:list->import-set imports))))
|
||||
|
||||
;; Convert from the import DB to a list of identifiers that are imported.
|
||||
|
|
Loading…
Add table
Reference in a new issue