omit bound id from generated literals (fixes #14)

v6.3-exception
Matthew Butterick 7 years ago
parent 4bea7423b1
commit 33acb10b31

@ -19,11 +19,14 @@
(for*/list ([pat-arg (in-list (syntax-flatten pats))] (for*/list ([pat-arg (in-list (syntax-flatten pats))]
[pat-datum (in-value (syntax->datum pat-arg))] [pat-datum (in-value (syntax->datum pat-arg))]
#:when (literal-identifier? pat-datum)) #:when (literal-identifier? pat-datum))
pat-arg)) pat-arg))
(define (generate-bound-and-unbound-literals pats #:treat-as-bound [bound-id #f]) (define (generate-bound-and-unbound-literals pats #:treat-as-bound [bound-id #f])
(define literals (generate-literals pats)) (define literals (for/list ([literal (in-list (generate-literals pats))]
; the bound-id should not appear in any literal list
#:unless (bound-identifier=? literal bound-id))
literal))
(define-values (bound-literals unbound-literals) (define-values (bound-literals unbound-literals)
(partition (λ (i) (or (identifier-binding i) (partition (λ (i) (or (identifier-binding i)
(and bound-id (bound-identifier=? i bound-id)))) literals)) (and bound-id (bound-identifier=? i bound-id)))) literals))

Loading…
Cancel
Save