(indent int, typ *super.TypeRecord, bytes scode.Bytes, known bool)
| 410 | } |
| 411 | |
| 412 | func (f *Formatter) formatRecord(indent int, typ *super.TypeRecord, bytes scode.Bytes, known bool) { |
| 413 | f.build("{") |
| 414 | if len(typ.Fields) == 0 { |
| 415 | f.build("}") |
| 416 | return |
| 417 | } |
| 418 | indent += f.tab |
| 419 | sep := f.newline |
| 420 | it := scode.NewRecordIter(bytes, typ.Opts) |
| 421 | for _, field := range typ.Fields { |
| 422 | f.build(sep) |
| 423 | f.startColor(color.Blue) |
| 424 | f.indent(indent, QuotedName(field.Name)) |
| 425 | if field.Opt { |
| 426 | f.build("?") |
| 427 | } |
| 428 | f.endColor() |
| 429 | f.build(":") |
| 430 | if f.tab > 0 { |
| 431 | f.build(" ") |
| 432 | } |
| 433 | elem, none := it.Next(field.Opt) |
| 434 | if none { |
| 435 | f.build("_") |
| 436 | f.startColor(color.Gray(200)) |
| 437 | f.build("::") |
| 438 | f.formatType(field.Type, true) |
| 439 | f.endColor() |
| 440 | } else { |
| 441 | f.formatValue(indent, field.Type, elem, known, true) |
| 442 | } |
| 443 | sep = "," + f.newline |
| 444 | } |
| 445 | f.build(f.newline) |
| 446 | f.indent(indent-f.tab, "}") |
| 447 | } |
| 448 | |
| 449 | func (f *Formatter) formatVector(indent int, open, close string, inner super.Type, val super.Value, known bool) bool { |
| 450 | f.build(open) |
no test coverage detected