mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 00:07:36 +02:00
Allow a program to use cond-expand for imports
This commit is contained in:
parent
3fe1dca790
commit
d57f55f406
1 changed files with 14 additions and 8 deletions
20
cyclone.scm
20
cyclone.scm
|
@ -288,6 +288,14 @@
|
|||
;; - imports
|
||||
;; - remaining program
|
||||
(define (import-reduction expr)
|
||||
;; TODO: consolidate this with other macro loading code
|
||||
(define rename-env (env:extend-environment '() '() '()))
|
||||
(let ((macros (filter
|
||||
(lambda (v)
|
||||
(Cyc-macro? (Cyc-get-cvar (cdr v))))
|
||||
(Cyc-global-vars))))
|
||||
(macro:load-env! macros (create-environment '() '())))
|
||||
;;
|
||||
(let ((results
|
||||
(foldl
|
||||
(lambda (ex accum)
|
||||
|
@ -298,14 +306,12 @@
|
|||
(else
|
||||
(cons (car accum) (cons e (cdr accum))))))
|
||||
(cond
|
||||
;; TODO: this part does not work yet, would need to load
|
||||
;; the base macro environment first
|
||||
;((tagged-list? 'cond-expand ex)
|
||||
; (let ((ex* (expand ex (macro:get-env) '())))
|
||||
((tagged-list? 'cond-expand ex)
|
||||
(let ((ex* (expand ex (macro:get-env) rename-env)))
|
||||
;(trace:info `(DEBUG ,ex* ,ex))
|
||||
; (if (tagged-list? 'import ex*)
|
||||
; (process ex*)
|
||||
; (process ex))))
|
||||
(if (tagged-list? 'import ex*)
|
||||
(process ex*)
|
||||
(process ex))))
|
||||
(else
|
||||
(process ex))))
|
||||
(cons '() '())
|
||||
|
|
Loading…
Add table
Reference in a new issue