MCPcopy Create free account
hub / github.com/cel-expr/cel-go / Program

Method Program

cel/env.go:716–724  ·  view source on GitHub ↗

Program generates an evaluable instance of the Ast within the environment (Env).

(ast *Ast, opts ...ProgramOption)

Source from the content-addressed store, hash-verified

714
715// Program generates an evaluable instance of the Ast within the environment (Env).
716func (e *Env) Program(ast *Ast, opts ...ProgramOption) (Program, error) {
717 // Surface any error recorded while the Ast was loaded (e.g. an over-deep AST rejected by
718 // ParsedExprToAst / CheckedExprToAst) rather than recursing into the planner on it. This is a
719 // cheap field read; the depth traversal itself runs once at conversion time, not here.
720 if ast != nil && ast.loadErr != nil {
721 return nil, ast.loadErr
722 }
723 return e.PlanProgram(ast.NativeRep(), opts...)
724}
725
726// PlanProgram generates an evaluable instance of the AST in the go-native representation within
727// the environment (Env).

Callers 15

TestSimpleVariablesFunction · 0.95
TestNetwork_SuccessFunction · 0.95
testCostFunction · 0.95
TestStringFormatFunction · 0.95
TestLiteralOutputFunction · 0.95
TestListsRuntimeErrorsFunction · 0.95
TestListsVersionFunction · 0.95
TestStringFormatV2Function · 0.95
TestNativeStructEmbeddedFunction · 0.95

Calls 2

PlanProgramMethod · 0.95
NativeRepMethod · 0.80

Tested by 15

TestSimpleVariablesFunction · 0.76
TestNetwork_SuccessFunction · 0.76
testCostFunction · 0.76
TestStringFormatFunction · 0.76
TestLiteralOutputFunction · 0.76
TestListsRuntimeErrorsFunction · 0.76
TestListsVersionFunction · 0.76
TestStringFormatV2Function · 0.76
TestNativeStructEmbeddedFunction · 0.76