From d8d762517f0a6f283527c15499be5ac08be080cf Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 17 Jul 2011 08:05:34 -0600 Subject: [PATCH] fix `get-module-path' and associated exception Closes PR 12029 --- collects/syntax/modcode.rkt | 6 ++---- collects/syntax/scribblings/modcode.scrbl | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/collects/syntax/modcode.rkt b/collects/syntax/modcode.rkt index cae33f1117..a722bceaee 100644 --- a/collects/syntax/modcode.rkt +++ b/collects/syntax/modcode.rkt @@ -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) diff --git a/collects/syntax/scribblings/modcode.scrbl b/collects/syntax/scribblings/modcode.scrbl index 55e8a50c1f..68692e4fb7 100644 --- a/collects/syntax/scribblings/modcode.scrbl +++ b/collects/syntax/scribblings/modcode.scrbl @@ -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].}