Fixed splicing-syntax-parameterize to splice require and provide forms.

svn: r18551
This commit is contained in:
Carl Eastlund 2010-03-16 23:04:46 +00:00
parent 123cd387f4
commit d9b7609e1e
2 changed files with 17 additions and 9 deletions

View File

@ -197,7 +197,12 @@
(syntax-case body (quote)
[(ls _ _ (quote body))
(let ([body #'body])
(syntax-case body (begin define-values define-syntaxes define-for-syntaxes)
(syntax-case body ( begin
define-values
define-syntaxes
define-for-syntaxes
#%require
#%provide )
[(begin expr ...)
(syntax/loc body
(begin (expand-ssp-body (sp-id ...) (temp-id ...) expr) ...))]
@ -208,6 +213,8 @@
rhs)))]
[(define-syntaxes . _) body]
[(define-for-syntaxes . _) body]
[(#%require . _) body]
[(#%provide . _) body]
[expr (syntax/loc body
(letrec-syntaxes ([(sp-id) (syntax-local-value (quote-syntax temp-id))] ...)
expr))]))]))]))

View File

@ -59,16 +59,17 @@ once during compilation as in @scheme[let-syntax], etc.
@defidform[splicing-syntax-parameterize]{
Like @scheme[syntax-parameterize], except that in a definition
context, the body forms are spliced into the enclosing definition
context (in the same as as for @scheme[begin]), as long as the body
forms are valid in an internal-definition context. In particular,
@scheme[require] and @scheme[provide] forms cannot appear in the body
of @scheme[splicing-syntax-parameterize], even if
@scheme[splicing-syntax-parameterize] is used in a @scheme[module]
body. In a definition context, the body of
Like @scheme[syntax-parameterize], except that in a definition context, the body
forms are spliced into the enclosing definition context (in the same way as for
@scheme[begin]). In a definition context, the body of
@scheme[splicing-syntax-parameterize] can be empty.
Note that @tech{require transformers} and @tech{provide transformers} are not
affected by syntax parameterization. While all uses of @scheme[require] and
@scheme[provide] will be spliced into the enclosing context, derived import or
export specifications will expand as if they had not been inside of the
@scheme[splicing-syntax-parameterize].
@examples[
#:eval splice-eval
(define-syntax-parameter place (lambda (stx) #'"Kansas"))