fix bug that errors when matching vector rule with non-vector expression

This commit is contained in:
zeptometer 2014-08-06 21:05:20 +09:00
parent b91939f5aa
commit 4f59e07539
1 changed files with 5 additions and 2 deletions

View File

@ -383,6 +383,7 @@
(define _pair? (r 'pair?))
(define _null? (r 'null?))
(define _symbol? (r 'symbol?))
(define _vector? (r 'vector?))
(define _eqv? (r 'eqv?))
(define _string=? (r 'string=?))
(define _map (r 'map))
@ -519,8 +520,10 @@
(lambda (pattern)
(let-values (((match vars) (compile-match-base (vector->list pattern))))
(values
`(,_let ((expr (,_vector->list expr)))
,match)
`(,_if (,_vector? expr)
(,_let ((expr (,_vector->list expr)))
,match)
(exit #f))
vars)))))
(let-values (((match vars) (compile-match-base (cdr pattern))))