(m *Map)
| 277 | } |
| 278 | |
| 279 | func (e *encodeGen) gMap(m *Map) { |
| 280 | if !e.p.ok() { |
| 281 | return |
| 282 | } |
| 283 | e.fuseHook() |
| 284 | vname := m.Varname() |
| 285 | e.writeAndCheckWithMapLimit(mapHeader, lenAsUint32, vname) |
| 286 | |
| 287 | e.p.printf("\nfor %s, %s := range %s {", m.Keyidx, m.Validx, vname) |
| 288 | if m.Key != nil { |
| 289 | if m.AllowBinMaps { |
| 290 | e.ctx.PushVar(m.Keyidx) |
| 291 | m.Key.SetVarname(m.Keyidx) |
| 292 | next(e, m.Key) |
| 293 | e.ctx.Pop() |
| 294 | } else { |
| 295 | keyIdx := m.Keyidx |
| 296 | if key, ok := m.Key.(*BaseElem); ok { |
| 297 | if m.AutoMapShims && CanAutoShim[key.Value] { |
| 298 | keyIdx = fmt.Sprintf("msgp.AutoShim{}.%sString(%s(%s))", key.Value.String(), strings.ToLower(key.Value.String()), keyIdx) |
| 299 | } else if key.Value == String { |
| 300 | keyIdx = fmt.Sprintf("%s(%s)", key.ToBase(), keyIdx) |
| 301 | } else if key.alias != "" { |
| 302 | keyIdx = fmt.Sprintf("string(%s)", keyIdx) |
| 303 | } |
| 304 | } |
| 305 | e.writeAndCheck(stringTyp, literalFmt, keyIdx) |
| 306 | } |
| 307 | } else { |
| 308 | e.writeAndCheck(stringTyp, literalFmt, m.Keyidx) |
| 309 | } |
| 310 | e.ctx.PushVar(m.Keyidx) |
| 311 | m.Value.SetIsAllowNil(false) |
| 312 | setTypeParams(m.Value, m.typeParams) |
| 313 | next(e, m.Value) |
| 314 | e.ctx.Pop() |
| 315 | e.p.closeblock() |
| 316 | } |
| 317 | |
| 318 | func (e *encodeGen) gPtr(s *Ptr) { |
| 319 | if !e.p.ok() { |
nothing calls this directly
no test coverage detected