syntax/parse: Arrange for built-in macro’s names to be preserved
The dance that syntax/parse performs to lazily load its implementation rewrites uses of syntax/parse macros in such a way that their original names were discarded, which shows up in error messages. By simply invoking the underlying transformer directly in the proxy macro instead of expanding to a rewritten use, users’ names can be preserved. fixes #1909
This commit is contained in:
parent
93ae78af91
commit
fb80d18428
|
@ -1,5 +1,6 @@
|
||||||
#lang scheme
|
#lang scheme
|
||||||
(require syntax/parse
|
(require syntax/parse
|
||||||
|
(only-in syntax/parse [syntax-parse renamed-syntax-parse])
|
||||||
syntax/parse/debug
|
syntax/parse/debug
|
||||||
rackunit
|
rackunit
|
||||||
"setup.rkt")
|
"setup.rkt")
|
||||||
|
@ -206,3 +207,7 @@
|
||||||
#rx"expected attribute name")
|
#rx"expected attribute name")
|
||||||
;; two more
|
;; two more
|
||||||
|
|
||||||
|
(tcerr "renamed syntax-parse bad syntax"
|
||||||
|
(renamed-syntax-parse)
|
||||||
|
#rx"^renamed-syntax-parse: ")
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
;; keep and keep as abs. path -- lazy-loaded macros produce references to this
|
;; keep and keep as abs. path -- lazy-loaded macros produce references to this
|
||||||
;; must be required via *absolute module path* from any disappearing module
|
;; must be required via *absolute module path* from any disappearing module
|
||||||
;; (so for consistency etc, require absolutely from all modules)
|
;; (so for consistency etc, require absolutely from all modules)
|
||||||
(require syntax/parse/private/residual
|
(require syntax/parse/private/residual)
|
||||||
racket/syntax
|
|
||||||
racket/stxparam
|
|
||||||
syntax/stx)
|
|
||||||
|
|
||||||
(begin-for-syntax
|
(begin-for-syntax
|
||||||
(lazy-require
|
(lazy-require
|
||||||
|
@ -60,9 +57,7 @@
|
||||||
define-eh-alternative-set)
|
define-eh-alternative-set)
|
||||||
(let ([tx (lambda (get-id)
|
(let ([tx (lambda (get-id)
|
||||||
(lambda (stx)
|
(lambda (stx)
|
||||||
(syntax-case stx ()
|
((syntax-local-value (get-id)) stx)))])
|
||||||
[(_ . args)
|
|
||||||
(datum->syntax stx (cons (get-id) #'args) stx)])))])
|
|
||||||
(values
|
(values
|
||||||
(tx id:define-syntax-class)
|
(tx id:define-syntax-class)
|
||||||
(tx id:define-splicing-syntax-class)
|
(tx id:define-splicing-syntax-class)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user