cs: fix error message for vector*
and box*
operations
This commit is contained in:
parent
1d7080fbb0
commit
7bcf6afb62
|
@ -12,7 +12,7 @@
|
|||
|
||||
(define collection 'multi)
|
||||
|
||||
(define version "7.2.0.2")
|
||||
(define version "7.2.0.3")
|
||||
|
||||
(define deps `("racket-lib"
|
||||
["racket" #:version ,version]))
|
||||
|
|
|
@ -23,8 +23,17 @@
|
|||
;; must handle impersonators
|
||||
(unbox b))
|
||||
|
||||
(define (unbox* b)
|
||||
(#2%unbox b))
|
||||
(define/who (unbox* b)
|
||||
(if (#%box? b)
|
||||
(#3%unbox b)
|
||||
(bad-box*-op who #f b)))
|
||||
|
||||
(define (bad-box*-op who set? b)
|
||||
(raise-argument-error who
|
||||
(if set?
|
||||
"(and/c box? (not immutable?) (not impersonator?))"
|
||||
"(and/c box? (not impersonator?))")
|
||||
b))
|
||||
|
||||
(define (set-box! b v)
|
||||
(if (#%mutable-box? b)
|
||||
|
@ -35,8 +44,10 @@
|
|||
;; must handle impersonators
|
||||
(set-box! b v))
|
||||
|
||||
(define (set-box*! b v)
|
||||
(#2%set-box! b v))
|
||||
(define/who (set-box*! b v)
|
||||
(if (#%mutable-box? b)
|
||||
(#3%set-box! b v)
|
||||
(bad-box*-op who #t b)))
|
||||
|
||||
;; in schemified:
|
||||
(define (unbox/check-undefined b name)
|
||||
|
|
|
@ -148,7 +148,12 @@
|
|||
(vector-length vec))
|
||||
|
||||
(define (vector*-length vec)
|
||||
(#2%vector-length vec))
|
||||
(if (#%vector? vec)
|
||||
(#3%vector-length vec)
|
||||
(bad-vector*-for-length vec)))
|
||||
|
||||
(define (bad-vector*-for-length vec)
|
||||
(raise-argument-error 'vector*-length "(and/c vector? (not impersonator?))" vec))
|
||||
|
||||
(define (impersonate-vector-length vec)
|
||||
(if (and (impersonator? vec)
|
||||
|
@ -176,7 +181,20 @@
|
|||
(pariah (impersonate-vector-ref vec idx))))
|
||||
|
||||
(define/who (vector*-ref vec idx)
|
||||
(#2%vector-ref vec idx))
|
||||
(if (#%$vector-ref-check? vec idx)
|
||||
(#3%vector-ref vec idx)
|
||||
(bad-vector*-op who #f vec idx)))
|
||||
|
||||
(define (bad-vector*-op who set? vec idx)
|
||||
(cond
|
||||
[set?
|
||||
(unless (#%mutable-vector? vec)
|
||||
(raise-argument-error who "(and/c vector? (not immutable?) (not impersonator?))" vec))]
|
||||
[else
|
||||
(unless (#%vector? vec)
|
||||
(raise-argument-error who "(and/c vector? (not impersonator?))" vec))])
|
||||
(check who exact-nonnegative-integer? idx)
|
||||
(check-range who "vector" vec idx #f (fx- (#%vector-length vec) 1)))
|
||||
|
||||
(define (impersonate-vector-ref orig idx)
|
||||
(if (and (impersonator? orig)
|
||||
|
@ -222,8 +240,10 @@
|
|||
(#3%vector-set! vec idx val)
|
||||
(pariah (impersonate-vector-set! vec idx val))))
|
||||
|
||||
(define (vector*-set! vec idx val)
|
||||
(#2%vector-set! vec idx val))
|
||||
(define/who (vector*-set! vec idx val)
|
||||
(if (#%$vector-set!-check? vec idx)
|
||||
(#3%vector-set! vec idx val)
|
||||
(bad-vector*-op who #t vec idx)))
|
||||
|
||||
(define (impersonate-vector-set! orig idx val)
|
||||
(cond
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
consistently.)
|
||||
*/
|
||||
|
||||
#define MZSCHEME_VERSION "7.2.0.2"
|
||||
#define MZSCHEME_VERSION "7.2.0.3"
|
||||
|
||||
#define MZSCHEME_VERSION_X 7
|
||||
#define MZSCHEME_VERSION_Y 2
|
||||
#define MZSCHEME_VERSION_Z 0
|
||||
#define MZSCHEME_VERSION_W 2
|
||||
#define MZSCHEME_VERSION_W 3
|
||||
|
||||
#define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y)
|
||||
#define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W)
|
||||
|
|
Loading…
Reference in New Issue
Block a user