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

Method Program

cel/env.go:723–731  ·  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

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