make serialization work right when a module is dynamic-required using a (non-string) path

svn: r2321

original commit: d9e3e1e2679fe7dac1972d417be44b70a177cb40
This commit is contained in:
Matthew Flatt 2006-02-26 17:45:37 +00:00
parent 2c827b5e6d
commit 8a2cb61fd7

View File

@ -423,6 +423,18 @@
(void? v)
(date? v)
(arity-at-least? v)))
;; If a module is dynamic-required through a path,
;; then it can cause simplified module paths to be paths;
;; keep the literal path, but marshal it to bytes.
(define (protect-path p)
(if (path? p)
(path->bytes p)
p))
(define (unprotect-path p)
(if (bytes? p)
(bytes->path p)
p))
(define (mod-to-id info mod-map cache)
(let ([deserialize-id (serialize-info-deserialize-id info)])
@ -438,10 +450,11 @@
(and (list? b)
(if (symbol? (caddr b))
(caddr b)
(collapse-module-path-index
(caddr b)
`(file ,(build-path (serialize-info-dir info)
"here.ss")))))
(protect-path
(collapse-module-path-index
(caddr b)
(build-path (serialize-info-dir info)
"here.ss")))))
(syntax-e deserialize-id)))]
[(symbol? deserialize-id)
(cons #f deserialize-id)]
@ -449,10 +462,11 @@
(cons
(if (symbol? (cdr deserialize-id))
(cdr deserialize-id)
(collapse-module-path-index
(cdr deserialize-id)
`(file ,(build-path (serialize-info-dir info)
"here.ss"))))
(protect-path
(collapse-module-path-index
(cdr deserialize-id)
(build-path (serialize-info-dir info)
"here.ss"))))
(car deserialize-id))])])
(hash-table-get
mod-map path+name
@ -818,7 +832,8 @@
(unless (null? l)
(let* ([path+name (car l)]
[des (if (car path+name)
(dynamic-require (car path+name) (cdr path+name))
(dynamic-require (unprotect-path (car path+name))
(cdr path+name))
(namespace-variable-value (cdr path+name)))])
;; Register maker and struct type:
(vector-set! mod-map n des))