fix deserialize submodule fallback

Fallback checked original module only if `deserialize-info` was
missing, but it's possible to have a mixture of `deserialize-info`
and original-module exports.
This commit is contained in:
Matthew Flatt 2013-11-08 20:13:59 -07:00
parent 90142edc5b
commit abe3647b67
2 changed files with 9 additions and 6 deletions

View File

@ -554,7 +554,7 @@ must be one of the following:
top-level is assumed. Before trying an exporting module directly,
its @racket[deserialize-info] submodule is tried; the module
itself is tried if no @racket[deserialize-info]
submodule is available. In either case, @racket[syntax-e] is used to
submodule is available or if the export is not found. In either case, @racket[syntax-e] is used to
obtain the name of an exported identifier or top-level definition.}
@item{If @racket[deserialize-id] is a symbol, it indicates a

View File

@ -658,12 +658,15 @@
(let ([p (unprotect-path (car path+name))]
[sym (revive-symbol (cdr path+name))])
((deserialize-module-guard) p sym)
(let ([sub (add-submodule p)])
(let ([sub (add-submodule p)]
[fallback
(lambda ()
;; On failure, for backward compatibility,
;; try module instead of submodule:
(dynamic-require p sym))])
(if (module-declared? sub #t)
(dynamic-require sub sym)
;; On failure, for backward compatibility,
;; try module instead of submodule:
(dynamic-require p sym))))
(dynamic-require sub sym fallback)
(fallback))))
(namespace-variable-value (cdr path+name)))])
;; Register maker and struct type:
(vector-set! mod-map n des))