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

Method Eval

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

Source from the content-addressed store, hash-verified

264}
265
266func (a *ArrayExpr) Eval(this super.Value) super.Value {
267 a.builder.Reset()
268 a.collection.reset()
269 for _, e := range a.elems {
270 if e.Value != nil {
271 a.collection.append(e.Value.Eval(this))
272 continue
273 }
274 val := e.Spread.Eval(this)
275 inner := super.InnerType(val.Type())
276 if inner == nil {
277 // Treat non-list spread values values like missing.
278 continue
279 }
280 a.collection.appendSpread(inner, val.Bytes())
281 }
282 if len(a.collection.types) == 0 {
283 return super.NewValue(a.sctx.LookupTypeArray(super.TypeNull), []byte{})
284 }
285 it := a.collection.iter(a.sctx)
286 for !it.done() {
287 it.appendNext(&a.builder)
288 }
289 return super.NewValue(a.sctx.LookupTypeArray(it.typ), a.builder.Bytes())
290}
291
292type SetExpr struct {
293 builder scode.Builder

Callers

nothing calls this directly

Calls 13

InnerTypeFunction · 0.92
NewValueFunction · 0.92
appendSpreadMethod · 0.80
LookupTypeArrayMethod · 0.80
iterMethod · 0.80
appendNextMethod · 0.80
EvalMethod · 0.65
TypeMethod · 0.65
ResetMethod · 0.45
resetMethod · 0.45
appendMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected