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

Method Eval

runtime/sam/expr/values.go:352–372  ·  view source on GitHub ↗
(this super.Value)

Source from the content-addressed store, hash-verified

350}
351
352func (m *MapExpr) Eval(this super.Value) super.Value {
353 m.keys.reset()
354 m.vals.reset()
355 for _, e := range m.entries {
356 m.keys.append(e.Key.Eval(this))
357 m.vals.append(e.Val.Eval(this))
358 }
359 if len(m.keys.types) == 0 {
360 typ := m.sctx.LookupTypeMap(super.TypeNull, super.TypeNull)
361 return super.NewValue(typ, []byte{})
362 }
363 m.builder.Reset()
364 kIter, vIter := m.keys.iter(m.sctx), m.vals.iter(m.sctx)
365 for !kIter.done() {
366 kIter.appendNext(&m.builder)
367 vIter.appendNext(&m.builder)
368 }
369 bytes := m.builder.Bytes()
370 typ := m.sctx.LookupTypeMap(kIter.typ, vIter.typ)
371 return super.NewValue(typ, super.NormalizeMap(bytes))
372}
373
374type collectionBuilder struct {
375 types []super.Type

Callers

nothing calls this directly

Calls 11

NewValueFunction · 0.92
NormalizeMapFunction · 0.92
LookupTypeMapMethod · 0.80
iterMethod · 0.80
appendNextMethod · 0.80
EvalMethod · 0.65
resetMethod · 0.45
appendMethod · 0.45
ResetMethod · 0.45
doneMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected