Merge pull request #243 from picrin-scheme/better-error-message

Improve error message for record accessor and setter
This commit is contained in:
Yuichi Nishiwaki 2015-01-18 20:45:47 +09:00
commit 5e3bd1e037
1 changed files with 3 additions and 3 deletions

View File

@ -80,16 +80,16 @@
`(define (,accessor record)
(if (,pred record)
(record-ref record ',field-name)
(error "wrong record type")))
(error (string-append (symbol->string ',accessor) ": wrong record type") record)))
`(begin
(define (,accessor record)
(if (,pred record)
(record-ref record ',field-name)
(error "wrong record type")))
(error (string-append (symbol->string ',accessor) ": wrong record type") record)))
(define (,(car modifier?) record val)
(if (,pred record)
(record-set! record ',field-name val)
(error "wrong record type")))))))))
(error (string-append (symbol->string ',(car modifier?)) ": wrong record type") record)))))))))
(define-syntax define-record-type
(ir-macro-transformer