improve error message for record accessor and setter

This commit is contained in:
Sunrin SHIMURA (keen) 2015-01-18 11:39:04 +00:00
parent a3db19c1bf
commit a0a35d189f
1 changed files with 3 additions and 3 deletions

View File

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