readKey will read the key into the variable named by m.Keyidx.
(ctx *Context, p printer, t traversal, assignAndCheck func(name string, base string))
| 396 | |
| 397 | // readKey will read the key into the variable named by m.Keyidx. |
| 398 | func (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 | |
| 412 | func (m *Map) Complexity() int { |
| 413 | // Complexity of maps are considered constant. Children should decide on their own. |