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

Method evalAtCompileTime

compiler/rungen/op.go:625–641  ·  view source on GitHub ↗
(in dag.Expr)

Source from the content-addressed store, hash-verified

623}
624
625func (b *Builder) evalAtCompileTime(in dag.Expr) (val super.Value, err error) {
626 if in == nil {
627 return super.Null, nil
628 }
629 e, err := b.compileExpr(in)
630 if err != nil {
631 return super.Null, err
632 }
633 // Catch panic as the runtime will panic if there is a
634 // reference to a var not in scope, a field access null this, etc.
635 defer func() {
636 if recover() != nil {
637 val = b.sctx().Missing()
638 }
639 }()
640 return e.Eval(b.sctx().Missing()), nil
641}
642
643func compileExpr(in dag.Expr) (expr.Evaluator, error) {
644 b := NewBuilder(runtime.NewContext(context.Background(), super.NewContext()), nil)

Callers 3

compileVamExprSwitchMethod · 0.95
compileExprSwitchMethod · 0.95
EvalAtCompileTimeFunction · 0.95

Implementers 15

DynamicBuildervector/builder.go
recordBuildervector/builder.go
arraySetBuildervector/builder.go
mapBuildervector/builder.go
unionBuildervector/builder.go
fusionBuildervector/builder.go
enumBuildervector/builder.go
intBuildervector/builder.go
uintBuildervector/builder.go
floatBuildervector/builder.go
boolBuildervector/builder.go
bytesStringTypeBuildervector/builder.go

Calls 4

compileExprMethod · 0.95
sctxMethod · 0.95
MissingMethod · 0.80
EvalMethod · 0.65

Tested by

no test coverage detected