Error messages for using places with symbol module paths

This commit is contained in:
Kevin Tew 2011-08-31 12:14:16 -06:00
parent 6e2487bffa
commit 261f002ce2
3 changed files with 9 additions and 4 deletions

View File

@ -147,8 +147,7 @@
(syntax-case stx ()
[(_ ch body1 body ...)
(begin
;breaks valid uses of place
#;(unless (eq? 'module (syntax-local-context))
#;(when (in-module-expansion?)
(raise-syntax-error #f "can only be used in a module" stx))
(unless (identifier? #'ch)
(raise-syntax-error #f "expected an indentifier" stx #'ch))
@ -165,6 +164,7 @@
(resolved-module-path-name
(variable-reference->resolved-module-path
vr)))
(dynamic-place (if (symbol? name) `',name name)
func-name))
(when (symbol? name)
(error 'place "the current module-path-name should be a path and not a symbol (if you are in DrRacket, save the file)"))
(dynamic-place name func-name))

View File

@ -5,6 +5,8 @@
(place-wait (place/base (p1 ch)
(printf "Hello from place\n")))
(err/rt-test (dynamic-place 'tmodule 'tfunc))
(let ([p (place/base (p1 ch)
(printf "Hello form place 2\n")
(exit 99))])

View File

@ -227,6 +227,9 @@ Scheme_Object *scheme_place(int argc, Scheme_Object *args[]) {
if (!scheme_is_module_path(args[0]) && !SCHEME_PATHP(args[0])) {
scheme_wrong_type("dynamic-place", "module-path or path", 0, argc, args);
}
if (SCHEME_SYMBOLP(args[0])) {
scheme_wrong_type("dynamic-place", "non-symbol module-path", 0, argc, args);
}
if (!SCHEME_SYMBOLP(args[1])) {
scheme_wrong_type("dynamic-place", "symbol", 1, argc, args);
}