Treat static struct info as pattern constructor.
This commit is contained in:
parent
1cf22896ce
commit
8047e32662
|
@ -153,6 +153,9 @@
|
|||
[(mcons e1 e2) (make-MPair (parse #'e1) (parse #'e2))]
|
||||
[(struct s pats)
|
||||
(parse-struct stx cert parse #'s #'pats)]
|
||||
[(s . pats)
|
||||
(struct-info? (syntax-local-value #'s (lambda () #f)))
|
||||
(parse-struct stx cert parse #'s #'pats)]
|
||||
[(? p q1 qs ...)
|
||||
(make-And (cons (make-Pred (cert #'p))
|
||||
(map parse (syntax->list #'(q1 qs ...)))))]
|
||||
|
|
|
@ -113,6 +113,16 @@
|
|||
[(box a) a]
|
||||
[(cons x y) (+ x y)]
|
||||
[_ 0])))
|
||||
|
||||
(comp
|
||||
6
|
||||
(let ()
|
||||
(match (make-X 1 2 3)
|
||||
[(X a b c) (+ a b c)]
|
||||
[(box a) a]
|
||||
[(cons x y) (+ x y)]
|
||||
[_ 0])))
|
||||
|
||||
|
||||
(comp
|
||||
6
|
||||
|
|
Loading…
Reference in New Issue
Block a user