MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / Compile

Function Compile

testing/testrunner/runner_lib.cc:78–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78absl::StatusOr<CheckedExpr> Compile(absl::string_view expression,
79 const CelTestContext& context) {
80 const auto* compiler = context.compiler();
81 if (compiler == nullptr) {
82 return absl::InvalidArgumentError(
83 "A compiler must be provided to compile a raw expression or .cel "
84 "file.");
85 }
86
87 CEL_ASSIGN_OR_RETURN(ValidationResult validation_result,
88 compiler->Compile(expression));
89 if (!validation_result.IsValid()) {
90 return absl::InternalError(validation_result.FormatError());
91 }
92
93 CheckedExpr checked_expr;
94 CEL_RETURN_IF_ERROR(
95 AstToCheckedExpr(*validation_result.GetAst(), &checked_expr));
96 return checked_expr;
97}
98
99absl::StatusOr<std::unique_ptr<cel::Program>> Plan(
100 const CheckedExpr& checked_expr, const cel::Runtime* runtime) {

Callers 2

CompileMethod · 0.85
GetCheckedExprMethod · 0.85

Calls 5

AstToCheckedExprFunction · 0.85
compilerMethod · 0.80
IsValidMethod · 0.80
FormatErrorMethod · 0.80
GetAstMethod · 0.80

Tested by

no test coverage detected