(types []super.Type, b scode.Bytes, typ *super.TypeRecord)
| 46 | } |
| 47 | |
| 48 | func (n *Flatten) appendTypes(types []super.Type, b scode.Bytes, typ *super.TypeRecord) []super.Type { |
| 49 | it := scode.NewRecordIter(b, typ.Opts) |
| 50 | for _, f := range typ.Fields { |
| 51 | val, none := it.Next(f.Opt) |
| 52 | if none { |
| 53 | continue |
| 54 | } |
| 55 | if typ := super.TypeRecordOf(f.Type); typ != nil && val != nil { |
| 56 | types = n.appendTypes(types, val, typ) |
| 57 | continue |
| 58 | } |
| 59 | typ, ok := n.entryTypes[f.Type] |
| 60 | if !ok { |
| 61 | typ = n.sctx.MustLookupTypeRecord([]super.Field{ |
| 62 | super.NewField("key", n.keyType), |
| 63 | super.NewField("value", f.Type), |
| 64 | }) |
| 65 | n.entryTypes[f.Type] = typ |
| 66 | } |
| 67 | types = append(types, typ) |
| 68 | } |
| 69 | return types |
| 70 | } |
| 71 | |
| 72 | func (n *Flatten) encode(typ *super.TypeRecord, inner super.Type, base field.Path, b scode.Bytes) { |
| 73 | it := scode.NewRecordIter(b, typ.Opts) |
no test coverage detected