@ -32,7 +32,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Array.coffee
'_currentOffset 0
'_length @len)
parent))
(define len (resolve-length @len #:parent parent))
(define len (resolve-length @len port #:parent parent))
(cond
[(or (not len) (eq? @length-type 'bytes))
(define end-pos (cond
@ -15,7 +15,7 @@ https://github.com/mbutterick/restructure/blob/master/src/Buffer.coffee
(raise-argument-error '+xbuffer "resolvable length" @len))
(define/augment (xxdecode port parent)
(read-bytes len))
(define/augment (xxencode buf port [parent #f])
@ -15,7 +15,7 @@ https://github.com/mbutterick/restructure/blob/master/src/LazyArray.coffee
(define/override (xxdecode port parent)
(define starting-pos (pos port)) ; ! placement matters. `resolve-length` will change `pos`
(define new-parent (if (xint? @len)
(mhasheq 'parent parent
'_startOffset starting-pos
@ -5,7 +5,7 @@
(define (length-resolvable? x)
(or (not x) (symbol? x) (xenomorphic? x) (procedure? x) (exact-nonnegative-integer? x)))
(define (resolve-length x [port (current-input-port)] #:parent [parent #f])
(define (resolve-length x port #:parent [parent #f])
[(not x) #f]
[(exact-nonnegative-integer? x) x]