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

Function arrayElemCast

sup/analyzer.go:356–364  ·  view source on GitHub ↗

Figure out what the cast should be for the elements and for the union conversion if any.

(cast super.Type)

Source from the content-addressed store, hash-verified

354
355// Figure out what the cast should be for the elements and for the union conversion if any.
356func arrayElemCast(cast super.Type) (super.Type, error) {
357 if cast == nil {
358 return nil, nil
359 }
360 if arrayType, ok := super.TypeUnder(cast).(*super.TypeArray); ok {
361 return arrayType.Type, nil
362 }
363 return nil, errors.New("array decorator not of type array")
364}
365
366func (a Analyzer) convertArray(sctx *super.Context, array *ast.Array, cast super.Type) (Value, error) {
367 vals := make([]Value, 0, len(array.Elements))

Callers 1

convertArrayMethod · 0.85

Calls 2

TypeUnderFunction · 0.92
NewMethod · 0.80

Tested by

no test coverage detected