fix `get-module-path' and associated exception
Closes PR 12029
This commit is contained in:
parent
67936b7a66
commit
d8d762517f
|
@ -10,7 +10,7 @@
|
||||||
make-exn:get-module-code)
|
make-exn:get-module-code)
|
||||||
|
|
||||||
(provide/contract
|
(provide/contract
|
||||||
[get-module-code (->* ((or/c path? module-path?))
|
[get-module-code (->* (path?)
|
||||||
(#:sub-path
|
(#:sub-path
|
||||||
(and/c path-string? relative-path?)
|
(and/c path-string? relative-path?)
|
||||||
(and/c path-string? relative-path?)
|
(and/c path-string? relative-path?)
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
v))))
|
v))))
|
||||||
(lambda () (close-input-port p)))))
|
(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
|
(define (get-module-code path
|
||||||
#:sub-path [sub-path0 "compiled"]
|
#:sub-path [sub-path0 "compiled"]
|
||||||
|
@ -85,8 +85,6 @@
|
||||||
#:notify [notify void]
|
#:notify [notify void]
|
||||||
#:source-reader [read-src-syntax read-syntax]
|
#:source-reader [read-src-syntax read-syntax]
|
||||||
#:rkt-try-ss? [rkt-try-ss? #t])
|
#: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)]
|
(let*-values ([(orig-path) (resolve path)]
|
||||||
[(base orig-file dir?) (split-path path)]
|
[(base orig-file dir?) (split-path path)]
|
||||||
[(main-file alt-file)
|
[(main-file alt-file)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
@defmodule[syntax/modcode]
|
@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"]
|
[#:sub-path compiled-subdir0 (and/c path-string? relative-path?) "compiled"]
|
||||||
[compiled-subdir (and/c path-string? relative-path?) compiled-subdir0]
|
[compiled-subdir (and/c path-string? relative-path?) compiled-subdir0]
|
||||||
[#:compile compile-proc0 (any/c . -> . any) compile]
|
[#:compile compile-proc0 (any/c . -> . any) compile]
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
any]{
|
any]{
|
||||||
|
|
||||||
Returns a compiled expression for the declaration of the module
|
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"];
|
The @racket[compiled-subdir] argument defaults to @racket["compiled"];
|
||||||
it specifies the sub-directory to search for a compiled version of the
|
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.}
|
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
|
An exception structure type for exceptions raised by
|
||||||
@racket[get-module-code].}
|
@racket[get-module-code].}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user