Fix handling of (or) in match.
svn: r13295
This commit is contained in:
parent
2962c0bfa7
commit
5baa4390d3
|
@ -177,9 +177,9 @@
|
|||
#f))
|
||||
|
||||
;; (listof pat) syntax -> void
|
||||
;; ps is never null
|
||||
;; check that all the ps bind the same set of variables
|
||||
(define (all-vars ps stx)
|
||||
(when (null? ps) (error 'bad))
|
||||
(define (all-vars ps stx)
|
||||
(let* ([first-vars (bound-vars (car ps))]
|
||||
[l (length ps)]
|
||||
[ht (make-free-identifier-mapping)])
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
"This expander only works with the standard match syntax")]
|
||||
[(and p ...)
|
||||
(make-And (map parse (syntax->list #'(p ...))))]
|
||||
[(or p ...)
|
||||
(let ([ps (map parse (syntax->list #'(p ...)))])
|
||||
[(or)
|
||||
(make-Not (make-Dummy stx))]
|
||||
[(or p ps ...)
|
||||
(let ([ps (map parse (syntax->list #'(p ps ...)))])
|
||||
(all-vars ps stx)
|
||||
(make-Or ps))]
|
||||
[(not p ...)
|
||||
|
|
|
@ -38,8 +38,10 @@
|
|||
(make-Var #'v)]
|
||||
[(and p ...)
|
||||
(make-And (map parse (syntax->list #'(p ...))))]
|
||||
[(or p ...)
|
||||
(let ([ps (map parse (syntax->list #'(p ...)))])
|
||||
[(or)
|
||||
(make-Not (make-Dummy stx))]
|
||||
[(or p ps ...)
|
||||
(let ([ps (map parse (syntax->list #'(p ps ...)))])
|
||||
(all-vars ps stx)
|
||||
(make-Or ps))]
|
||||
[(not p ...)
|
||||
|
|
|
@ -598,4 +598,9 @@
|
|||
[(? number?) (z)]))
|
||||
(lambda _ 12)))
|
||||
|
||||
|
||||
(comp 4
|
||||
(match 3
|
||||
[(or) 1]
|
||||
[_ 4]))
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue
Block a user