Make splicing-syntax-parameterize recur into module* without a mod-path

This commit is contained in:
Alexis King 2017-10-15 14:51:36 -07:00 committed by Matthew Flatt
parent 0f425f2029
commit 00d438cfbe
3 changed files with 24 additions and 1 deletions

View File

@ -73,6 +73,11 @@ affected by syntax parameterization. While all uses of @racket[require] and
export specifications will expand as if they had not been inside of the export specifications will expand as if they had not been inside of the
@racket[splicing-syntax-parameterize]. @racket[splicing-syntax-parameterize].
Additionally, @tech{submodules} defined with @racket[module*] that specify
@racket[#f] in place of a @tech{module path} @emph{are} affected by syntax
parameterization, but other submodules (those defined with @racket[module] or
@racket[module*] with a @tech{module path}) are @emph{not}.
@examples[ @examples[
#:eval splice-eval #:eval splice-eval
(define-syntax-parameter place (lambda (stx) #'"Kansas")) (define-syntax-parameter place (lambda (stx) #'"Kansas"))
@ -81,7 +86,12 @@ export specifications will expand as if they had not been inside of the
(splicing-syntax-parameterize ([place (lambda (stx) #'"Oz")]) (splicing-syntax-parameterize ([place (lambda (stx) #'"Oz")])
(define here (where))) (define here (where)))
here here
]} ]
@history[
#:changed "6.11.0.1"
@elem{Modified to syntax parameterize @racket[module*] submodules that
specify @racket[#f] in place of a @tech{module path}.}]}
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------

View File

@ -75,6 +75,12 @@
#`(quote #,v))))) #`(quote #,v)))))
(m))) (m)))
; make sure splicing-syntax-parameterize works with (module* _ #f ....)
(splicing-syntax-parameterize ([sp 'sub-submod])
(module* sp-submod #f
(provide b)
(m b)))
(provide x y z w f g)) (provide x y z w f g))
(test 'orig dynamic-require ''check-splicing-stxparam-1 'x) (test 'orig dynamic-require ''check-splicing-stxparam-1 'x)
@ -83,6 +89,7 @@
(test 'sub2 dynamic-require ''check-splicing-stxparam-1 'w) (test 'sub2 dynamic-require ''check-splicing-stxparam-1 'w)
(test 'nested values ((dynamic-require ''check-splicing-stxparam-1 'f))) (test 'nested values ((dynamic-require ''check-splicing-stxparam-1 'f)))
(test 'also-nested values ((dynamic-require ''check-splicing-stxparam-1 'g))) (test 'also-nested values ((dynamic-require ''check-splicing-stxparam-1 'g)))
(test 'sub-submod dynamic-require '(submod 'check-splicing-stxparam-1 sp-submod) 'b)
(module check-splicing-stxparam-et racket/base (module check-splicing-stxparam-et racket/base
(require (for-syntax racket/base) (require (for-syntax racket/base)

View File

@ -343,6 +343,9 @@
(syntax/loc/props body (syntax/loc/props body
(begin-for-syntax (wrap-param-et e (orig-id ...) (temp-id ...)) ...))] (begin-for-syntax (wrap-param-et e (orig-id ...) (temp-id ...)) ...))]
[(module . _) body] [(module . _) body]
[(module* n #f form ...)
(syntax/loc/props body
(module* n #f (expand-ssp-body (sp-id ...) (temp-id ...) (orig-id ...) form) ...))]
[(module* . _) body] [(module* . _) body]
[(#%require . _) body] [(#%require . _) body]
[(#%provide . _) body] [(#%provide . _) body]
@ -408,6 +411,9 @@
(syntax/loc/props e (syntax/loc/props e
(define-values ids (wrap-param-et rhs (orig-id ...) (temp-id ...))))] (define-values ids (wrap-param-et rhs (orig-id ...) (temp-id ...))))]
[(module . _) e] [(module . _) e]
[(module* n #f form ...)
(syntax/loc/props e
(module* n #f (wrap-param-et form (orig-id ...) (temp-id ...)) ...))]
[(module* . _) e] [(module* . _) e]
[(#%require . _) e] [(#%require . _) e]
[(#%provide . _) e] [(#%provide . _) e]