(in dag.Expr)
| 623 | } |
| 624 | |
| 625 | func (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 | |
| 643 | func compileExpr(in dag.Expr) (expr.Evaluator, error) { |
| 644 | b := NewBuilder(runtime.NewContext(context.Background(), super.NewContext()), nil) |
no test coverage detected