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

Method readKey

gen/elem.go:398–410  ·  view source on GitHub ↗

readKey will read the key into the variable named by m.Keyidx.

(ctx *Context, p printer, t traversal, assignAndCheck func(name string, base string))

Source from the content-addressed store, hash-verified

396
397// readKey will read the key into the variable named by m.Keyidx.
398func (m *Map) readKey(ctx *Context, p printer, t traversal, assignAndCheck func(name string, base string)) {
399 if m.Key != nil && m.AllowBinMaps {
400 p.declare(m.Keyidx, m.Key.TypeName())
401 ctx.PushVar(m.Keyidx)
402 m.Key.SetVarname(m.Keyidx)
403 next(t, m.Key)
404 ctx.Pop()
405 return
406 }
407 // No key, so we assume the key as a string.
408 p.declare(m.Keyidx, "string")
409 assignAndCheck(m.Keyidx, stringTyp)
410}
411
412func (m *Map) Complexity() int {
413 // Complexity of maps are considered constant. Children should decide on their own.

Callers 2

gMapMethod · 0.80
gMapMethod · 0.80

Calls 6

nextFunction · 0.85
declareMethod · 0.80
PushVarMethod · 0.80
PopMethod · 0.80
TypeNameMethod · 0.65
SetVarnameMethod · 0.65

Tested by

no test coverage detected