MCPcopy Create free account
hub / github.com/brimdata/super / formatVector

Method formatVector

sup/formatter.go:449–478  ·  view source on GitHub ↗
(indent int, open, close string, inner super.Type, val super.Value, known bool)

Source from the content-addressed store, hash-verified

447}
448
449func (f *Formatter) formatVector(indent int, open, close string, inner super.Type, val super.Value, known bool) bool {
450 f.build(open)
451 n, err := val.ContainerLength()
452 if err != nil {
453 panic(err)
454 }
455 if n == 0 {
456 f.build(close)
457 return true
458 }
459 indent += f.tab
460 sep := f.newline
461 it := val.ContainerIter()
462 elems := newElemBuilder(inner)
463 for !it.Done() {
464 f.build(sep)
465 f.indent(indent, "")
466 typ, b := elems.add(it.Next())
467 f.formatValue(indent, typ, b, known, true)
468 sep = "," + f.newline
469 }
470 f.build(f.newline)
471 f.indent(indent-f.tab, close)
472 if elems.needsDecoration() {
473 // If we haven't seen all the types in the union, print the decorator
474 // so the fullness of the union is persevered.
475 f.decorate(val.Type(), true)
476 }
477 return false
478}
479
480type elemHelper struct {
481 typ super.Type

Callers 1

formatValueMethod · 0.95

Calls 12

buildMethod · 0.95
indentMethod · 0.95
formatValueMethod · 0.95
decorateMethod · 0.95
newElemBuilderFunction · 0.85
ContainerLengthMethod · 0.80
ContainerIterMethod · 0.80
needsDecorationMethod · 0.80
TypeMethod · 0.65
DoneMethod · 0.45
addMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected