Compatibility with Racket 7: the syntax? field of attribute-mapping is now called check, and holds a different value.

This commit is contained in:
Georges Dupéron 2018-05-17 02:28:45 +02:00
parent 8f4ae46c6e
commit 6f663028cb

View File

@ -9,14 +9,22 @@
(version-case (version-case
[(version< (version) "6.90.0.24") [(version< (version) "6.90.0.24")
(require (prefix-in - syntax/parse/private/residual))] (require (prefix-in - syntax/parse/private/residual))
(define-for-syntax (compatibility-syntax-or-check syntax?)
syntax?)]
[else [else
(require (rename-in (prefix-in - racket/private/template) (require (rename-in (prefix-in - racket/private/template)
[-attribute-mapping -make-attribute-mapping])) [-attribute-mapping -make-attribute-mapping])
(only-in syntax/parse/private/residual ;; must be an absolute path
check-attr-value))
(define-for-syntax (-attribute-mapping-syntax? x) (define-for-syntax (-attribute-mapping-syntax? x)
;; attribute-mapping-check is actually false when attribute-mapping-syntax? ;; attribute-mapping-check is actually false when attribute-mapping-syntax?
;; would have been true (thanks rmculpepper !) ;; would have been true (thanks rmculpepper !)
(not (-attribute-mapping-check x)))]) (not (-attribute-mapping-check x)))
(define-for-syntax (compatibility-syntax-or-check syntax?)
(if syntax?
#f
(quote-syntax check-attr-value)))])
(provide attribute* (provide attribute*
(for-syntax attribute-info) (for-syntax attribute-info)
@ -90,7 +98,7 @@
(-make-attribute-mapping (quote-syntax valvar) (-make-attribute-mapping (quote-syntax valvar)
'name 'name
'depth 'depth
'syntax?)) (compatibility-syntax-or-check 'syntax?)))
(define-syntax name (define-syntax name
(make-syntax-mapping 'depth (make-syntax-mapping 'depth
(quote-syntax tmp-attr))))) (quote-syntax tmp-attr)))))