fix broken earlier commit

This commit is contained in:
Robby Findler 2011-05-25 14:42:37 -05:00
parent e3c552b785
commit d74810a08b

View File

@ -1120,19 +1120,24 @@
(define-struct match (bindings) #:inspector #f) (define-struct match (bindings) #:inspector #f)
(define (do-test-match lang pat binders name) (define (do-test-match lang pat binders context-name)
(unless (compiled-lang? lang) (unless (compiled-lang? lang)
(error 'redex-match "expected first argument to be a language, got ~e" lang)) (error 'redex-match "expected first argument to be a language, got ~e" lang))
(let ([cpat (compile-pattern lang pat #t)]) (define name (or context-name
(procedure-rename (and (symbol? pat)
pat)))
(define cpat (compile-pattern lang pat #t))
(define redex-match-proc
(λ (exp) (λ (exp)
(let ([ans (match-pattern cpat exp)]) (let ([ans (match-pattern cpat exp)])
(and ans (and ans
(map (λ (m) (make-match (sort-bindings (map (λ (m) (make-match (sort-bindings
(filter (λ (x) (memq (bind-name x) binders)) (filter (λ (x) (memq (bind-name x) binders))
(bindings-table (mtch-bindings m)))))) (bindings-table (mtch-bindings m))))))
ans)))) ans)))))
name))) (if name
(procedure-rename redex-match-proc name)
redex-match-proc))
(define (sort-bindings bnds) (define (sort-bindings bnds)
(sort (sort