Fixed splicing-syntax-parameterize to splice require and provide forms.
svn: r18551
This commit is contained in:
parent
123cd387f4
commit
d9b7609e1e
|
@ -197,7 +197,12 @@
|
||||||
(syntax-case body (quote)
|
(syntax-case body (quote)
|
||||||
[(ls _ _ (quote body))
|
[(ls _ _ (quote body))
|
||||||
(let ([body #'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 ...)
|
[(begin expr ...)
|
||||||
(syntax/loc body
|
(syntax/loc body
|
||||||
(begin (expand-ssp-body (sp-id ...) (temp-id ...) expr) ...))]
|
(begin (expand-ssp-body (sp-id ...) (temp-id ...) expr) ...))]
|
||||||
|
@ -208,6 +213,8 @@
|
||||||
rhs)))]
|
rhs)))]
|
||||||
[(define-syntaxes . _) body]
|
[(define-syntaxes . _) body]
|
||||||
[(define-for-syntaxes . _) body]
|
[(define-for-syntaxes . _) body]
|
||||||
|
[(#%require . _) body]
|
||||||
|
[(#%provide . _) body]
|
||||||
[expr (syntax/loc body
|
[expr (syntax/loc body
|
||||||
(letrec-syntaxes ([(sp-id) (syntax-local-value (quote-syntax temp-id))] ...)
|
(letrec-syntaxes ([(sp-id) (syntax-local-value (quote-syntax temp-id))] ...)
|
||||||
expr))]))]))]))
|
expr))]))]))]))
|
||||||
|
|
|
@ -59,16 +59,17 @@ once during compilation as in @scheme[let-syntax], etc.
|
||||||
|
|
||||||
@defidform[splicing-syntax-parameterize]{
|
@defidform[splicing-syntax-parameterize]{
|
||||||
|
|
||||||
Like @scheme[syntax-parameterize], except that in a definition
|
Like @scheme[syntax-parameterize], except that in a definition context, the body
|
||||||
context, the body forms are spliced into the enclosing definition
|
forms are spliced into the enclosing definition context (in the same way as for
|
||||||
context (in the same as as for @scheme[begin]), as long as the body
|
@scheme[begin]). In a definition context, the body of
|
||||||
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
|
|
||||||
@scheme[splicing-syntax-parameterize] can be empty.
|
@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[
|
@examples[
|
||||||
#:eval splice-eval
|
#:eval splice-eval
|
||||||
(define-syntax-parameter place (lambda (stx) #'"Kansas"))
|
(define-syntax-parameter place (lambda (stx) #'"Kansas"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user