fix `get-module-path' and associated exception

Closes PR 12029
This commit is contained in:
Matthew Flatt 2011-07-17 08:05:34 -06:00
parent 67936b7a66
commit d8d762517f
2 changed files with 5 additions and 7 deletions

View File

@ -10,7 +10,7 @@
make-exn:get-module-code)
(provide/contract
[get-module-code (->* ((or/c path? module-path?))
[get-module-code (->* (path?)
(#:sub-path
(and/c path-string? relative-path?)
(and/c path-string? relative-path?)
@ -74,7 +74,7 @@
v))))
(lambda () (close-input-port p)))))
(define-struct (exn:get-module-code exn) (path))
(define-struct (exn:get-module-code exn:fail) (path))
(define (get-module-code path
#:sub-path [sub-path0 "compiled"]
@ -85,8 +85,6 @@
#:notify [notify void]
#:source-reader [read-src-syntax read-syntax]
#:rkt-try-ss? [rkt-try-ss? #t])
(unless (path-string? path)
(raise-type-error 'get-module-code "path or string (sans nul)" path))
(let*-values ([(orig-path) (resolve path)]
[(base orig-file dir?) (split-path path)]
[(main-file alt-file)

View File

@ -5,7 +5,7 @@
@defmodule[syntax/modcode]
@defproc[(get-module-code [module-path-v module-path?]
@defproc[(get-module-code [path path?]
[#:sub-path compiled-subdir0 (and/c path-string? relative-path?) "compiled"]
[compiled-subdir (and/c path-string? relative-path?) compiled-subdir0]
[#:compile compile-proc0 (any/c . -> . any) compile]
@ -24,7 +24,7 @@
any]{
Returns a compiled expression for the declaration of the module
specified by @racket[module-path-v].
specified by @racket[path].
The @racket[compiled-subdir] argument defaults to @racket["compiled"];
it specifies the sub-directory to search for a compiled version of the
@ -74,7 +74,7 @@ A parameter whose value is used like @racket[open-input-file] to read
a module source or @filepath{.zo} file.}
@defstruct[(exn:get-module-code exn) ([path path?])]{
@defstruct[(exn:get-module-code exn:fail) ([path path?])]{
An exception structure type for exceptions raised by
@racket[get-module-code].}