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

Method gMap

gen/decode.go:440–464  ·  view source on GitHub ↗
(m *Map)

Source from the content-addressed store, hash-verified

438}
439
440func (d *decodeGen) gMap(m *Map) {
441 if !d.p.ok() {
442 return
443 }
444 sz := randIdent()
445
446 // resize or allocate map
447 d.p.declare(sz, u32)
448 d.assignMap(sz, mapHeader, 0)
449 d.p.resizeMap(sz, m)
450
451 // for element in map, read string/value
452 // pair and assign
453 d.needsField()
454 d.p.printf("\nfor %s > 0 {\n%s--", sz, sz)
455 m.readKey(d.ctx, d.p, d, d.assignAndCheck)
456 d.p.declare(m.Validx, m.Value.TypeName())
457 d.ctx.PushVar(m.Keyidx)
458 m.Value.SetIsAllowNil(false)
459 setTypeParams(m.Value, m.typeParams)
460 next(d, m.Value)
461 d.p.mapAssign(m)
462 d.ctx.Pop()
463 d.p.closeblock()
464}
465
466func (d *decodeGen) gSlice(s *Slice) {
467 if !d.p.ok() {

Callers

nothing calls this directly

Calls 15

assignMapMethod · 0.95
needsFieldMethod · 0.95
randIdentFunction · 0.85
setTypeParamsFunction · 0.85
nextFunction · 0.85
okMethod · 0.80
declareMethod · 0.80
resizeMapMethod · 0.80
printfMethod · 0.80
readKeyMethod · 0.80
PushVarMethod · 0.80
mapAssignMethod · 0.80

Tested by

no test coverage detected