Repair latent error of mismatched key types
This commit is contained in:
parent
86b74cd807
commit
3bbad3df6d
|
@ -345,13 +345,15 @@
|
||||||
[(key (in-list path))]
|
[(key (in-list path))]
|
||||||
(step-term term key)))
|
(step-term term key)))
|
||||||
|
|
||||||
|
(define (index? k) (exact-nonnegative-integer? k))
|
||||||
|
|
||||||
(define (step-term term key)
|
(define (step-term term key)
|
||||||
(cond [(non-object-struct? term)
|
(cond [(non-object-struct? term)
|
||||||
(define v (struct->vector term))
|
(define v (struct->vector term))
|
||||||
(define k (+ key 1)) ;; skip the label
|
(define k (+ key 1)) ;; skip the label
|
||||||
(if (>= k (vector-length v)) (void) (vector-ref v k))]
|
(when (and (index? k) (< k (vector-length v))) (vector-ref v k))]
|
||||||
[(list? term)
|
[(list? term)
|
||||||
(if (>= key (length term)) (void) (list-ref term key))]
|
(when (and (index? key) (< key (length term))) (list-ref term key))]
|
||||||
[(hash? term)
|
[(hash? term)
|
||||||
(hash-ref term key (void))]
|
(hash-ref term key (void))]
|
||||||
[else
|
[else
|
||||||
|
|
Loading…
Reference in New Issue