MCPcopy
hub / github.com/tinylib/msgp / gArray

Method gArray

gen/decode.go:482–499  ·  view source on GitHub ↗
(a *Array)

Source from the content-addressed store, hash-verified

480}
481
482func (d *decodeGen) gArray(a *Array) {
483 if !d.p.ok() {
484 return
485 }
486
487 // special case if we have [const]byte
488 if be, ok := a.Els.(*BaseElem); ok && (be.Value == Byte || be.Value == Uint8) {
489 d.p.printf("\nerr = dc.ReadExactBytes((%s)[:])", a.Varname())
490 d.p.wrapErrCheck(d.ctx.ArgsStr())
491 return
492 }
493 sz := randIdent()
494 d.p.declare(sz, u32)
495 d.assignAndCheck(sz, arrayHeader)
496 d.p.arrayCheck(coerceArraySize(a.Size), sz)
497 setTypeParams(a.Els, a.typeParams)
498 d.p.rangeBlock(d.ctx, a.Index, a.Varname(), d, a.Els)
499}
500
501func (d *decodeGen) gPtr(p *Ptr) {
502 if !d.p.ok() {

Callers

nothing calls this directly

Calls 12

assignAndCheckMethod · 0.95
randIdentFunction · 0.85
coerceArraySizeFunction · 0.85
setTypeParamsFunction · 0.85
okMethod · 0.80
printfMethod · 0.80
wrapErrCheckMethod · 0.80
ArgsStrMethod · 0.80
declareMethod · 0.80
arrayCheckMethod · 0.80
rangeBlockMethod · 0.80
VarnameMethod · 0.65

Tested by

no test coverage detected