Add disappeared-use properties for struct ids.

Fix bug with handling of identifier as second arg to `define-match-expander'

svn: r16201
This commit is contained in:
Sam Tobin-Hochstadt 2009-10-01 18:59:12 +00:00
parent 224a9546b8
commit 65d804d286
2 changed files with 24 additions and 20 deletions

View File

@ -1,22 +1,21 @@
#lang scheme/base
(require scheme/match/match
(for-syntax scheme/base))
(provide (except-out (all-from-out scheme/match/match)
define-match-expander)
(rename-out [define-match-expander* define-match-expander]))
(module match scheme/base
(require scheme/match/match
(for-syntax scheme/base))
(provide (except-out (all-from-out scheme/match/match)
define-match-expander)
(rename-out [define-match-expander* define-match-expander]))
(define-for-syntax (no-old-match-form stx)
(raise-syntax-error
#f
"works only for constructor-based `match' form"
stx))
(define-for-syntax (no-old-match-form stx)
(raise-syntax-error
#f
"works only for constructor-based `match' form"
stx))
(define-syntax define-match-expander*
(syntax-rules ()
[(_ id expr) (define-match-expander id expr)]
[(_ id expr expr2) (define-match-expander id
expr
no-old-match-form
expr2)])))
(define-syntax define-match-expander*
(syntax-rules ()
[(_ id expr) (define-match-expander id expr)]
[(_ id expr expr2) (define-match-expander id
expr
no-old-match-form
(#%expression expr2))]))

View File

@ -93,7 +93,12 @@
[acc (cond [(null? acc) acc]
[(not (car acc)) (cdr acc)]
[else acc])])
(make-Struct id pred (get-lineage (cert struct-name)) acc
(make-Struct id
(syntax-property
pred
'disappeared-use (list struct-name))
(get-lineage (cert struct-name))
acc
(cond [(eq? '_ (syntax-e pats))
(map make-Dummy acc)]
[(syntax->list pats)