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

Function AstToCheckedExpr

common/ast_proto.cc:521–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521absl::Status AstToCheckedExpr(
522 const Ast& ast, cel::expr::CheckedExpr* absl_nonnull out) {
523 if (!ast.is_checked()) {
524 return absl::InvalidArgumentError("AST is not type-checked");
525 }
526 CheckedExprPb& checked_expr = *out;
527 checked_expr.set_expr_version(ast.expr_version());
528 CEL_RETURN_IF_ERROR(
529 ExprToProto(ast.root_expr(), checked_expr.mutable_expr()));
530 CEL_RETURN_IF_ERROR(ast_internal::SourceInfoToProto(
531 ast.source_info(), checked_expr.mutable_source_info()));
532 for (auto it = ast.reference_map().begin(); it != ast.reference_map().end();
533 ++it) {
534 ReferencePb& dest_reference =
535 (*checked_expr.mutable_reference_map())[it->first];
536 CEL_ASSIGN_OR_RETURN(dest_reference, ReferenceToProto(it->second));
537 }
538
539 for (auto it = ast.type_map().begin(); it != ast.type_map().end(); ++it) {
540 TypePb& dest_type = (*checked_expr.mutable_type_map())[it->first];
541 CEL_RETURN_IF_ERROR(TypeToProto(it->second, &dest_type));
542 }
543
544 return absl::OkStatus();
545}
546
547} // namespace cel

Callers 11

TESTFunction · 0.85
TEST_PFunction · 0.85
CompileToProtoMethod · 0.85
TEST_PFunction · 0.85
CompileToCheckedExprFunction · 0.85
CheckImplFunction · 0.85
TESTFunction · 0.85
CompileFunction · 0.85
TEST_PFunction · 0.85
TESTFunction · 0.85
simple.ccFile · 0.85

Calls 11

ExprToProtoFunction · 0.85
SourceInfoToProtoFunction · 0.85
ReferenceToProtoFunction · 0.85
is_checkedMethod · 0.80
set_expr_versionMethod · 0.80
expr_versionMethod · 0.80
source_infoMethod · 0.80
TypeToProtoFunction · 0.70
CEL_ASSIGN_OR_RETURNFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by 7

TESTFunction · 0.68
TEST_PFunction · 0.68
CompileToProtoMethod · 0.68
TEST_PFunction · 0.68
TESTFunction · 0.68
TEST_PFunction · 0.68
TESTFunction · 0.68