fix raco exe' for cycles created via define-runtime-module-path'

This commit is contained in:
Matthew Flatt 2011-10-03 08:59:30 -06:00
parent a0378d956a
commit e640041dd6

View File

@ -341,9 +341,10 @@
;; Loads module code, using .zo if there, compiling from .scm if not
(define (get-code filename module-path codes prefixes verbose? collects-dest on-extension
compiler expand-namespace get-extra-imports)
compiler expand-namespace get-extra-imports working)
(let ([a (assoc filename (unbox codes))])
(if a
(cond
[a
;; Already have this module. Make sure that library-referenced
;; modules are consistently referenced through library paths:
(let ([found-lib? (is-lib-path? (mod-mod-path a))]
@ -355,12 +356,17 @@
(error 'find-module
"module referenced both as a library and through a path: ~a"
filename)]
[else 'ok]))
[else 'ok]))]
[(hash-ref working filename #f)
;; in the process of loading the module; a cycle
;; is possible through `define-runtime-path'
'ok]
[else
;; First use of the module. Get code and then get code for imports.
(begin
(when verbose?
(fprintf (current-error-port) "Getting ~s\n" filename))
(let ([actual-filename filename]) ; `set!'ed below to adjust file suffix
(hash-set! working filename #t)
(let ([code (get-module-code filename
"compiled"
compiler
@ -455,7 +461,8 @@
on-extension
compiler
expand-namespace
get-extra-imports))
get-extra-imports
working))
(append sub-files extra-files)
(append sub-paths normalized-extra-paths))
(when verbose?
@ -521,7 +528,7 @@
name #f #f
null null null
actual-filename)
(unbox codes)))])))))))
(unbox codes)))])))])))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -822,7 +829,8 @@
[get-code-at (lambda (f mp)
(get-code f mp codes prefix-mapping verbose? collects-dest
on-extension compiler expand-namespace
get-extra-imports))]
get-extra-imports
(make-hash)))]
[__
;; Load all code:
(for-each get-code-at files collapsed-mps)]