Refactoring and TODO

This commit is contained in:
Justin Ethier 2017-02-03 23:46:06 +00:00
parent 420098fb1e
commit c8c8ad6e3f

View file

@ -287,16 +287,7 @@
;; Read top-level imports from a program and return a cons of: ;; Read top-level imports from a program and return a cons of:
;; - imports ;; - imports
;; - remaining program ;; - remaining program
(define (import-reduction expr) (define (import-reduction expr expander)
; ;; 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 '() '())))
; ;;
(define expander (base-expander))
(let ((results (let ((results
(foldl (foldl
(lambda (ex accum) (lambda (ex accum)
@ -350,8 +341,11 @@
(define (run-compiler args cc? append-dirs prepend-dirs) (define (run-compiler args cc? append-dirs prepend-dirs)
(let* ((in-file (car args)) (let* ((in-file (car args))
(in-prog (read-file in-file)) (in-prog (read-file in-file))
;; TODO: expand in-prog, if a library, using lib:cond-expand.
;; TODO: will also need to do below in lib:get-all-import-deps, after reading each library
(expander (base-expander))
(program? (not (library? (car in-prog)))) (program? (not (library? (car in-prog))))
(program:imports/code (if program? (import-reduction in-prog) '())) (program:imports/code (if program? (import-reduction in-prog expander) '()))
(lib-deps (lib-deps
(if (and program? (if (and program?
(not (null? (car program:imports/code)))) (not (null? (car program:imports/code))))