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

Method Eval

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

Source from the content-addressed store, hash-verified

304}
305
306func (a *SetExpr) Eval(this super.Value) super.Value {
307 a.builder.Reset()
308 a.collection.reset()
309 for _, e := range a.elems {
310 if e.Value != nil {
311 a.collection.append(e.Value.Eval(this))
312 continue
313 }
314 val := e.Spread.Eval(this)
315 inner := super.InnerType(val.Type())
316 if inner == nil {
317 // Treat non-list spread values values like missing.
318 continue
319 }
320 a.collection.appendSpread(inner, val.Bytes())
321 }
322 if len(a.collection.types) == 0 {
323 return super.NewValue(a.sctx.LookupTypeSet(super.TypeNull), []byte{})
324 }
325 it := a.collection.iter(a.sctx)
326 for !it.done() {
327 it.appendNext(&a.builder)
328 }
329 return super.NewValue(a.sctx.LookupTypeSet(it.typ), super.NormalizeSet(a.builder.Bytes()))
330}
331
332type Entry struct {
333 Key Evaluator

Callers

nothing calls this directly

Calls 14

InnerTypeFunction · 0.92
NewValueFunction · 0.92
NormalizeSetFunction · 0.92
appendSpreadMethod · 0.80
LookupTypeSetMethod · 0.80
iterMethod · 0.80
appendNextMethod · 0.80
EvalMethod · 0.65
TypeMethod · 0.65
ResetMethod · 0.45
resetMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected