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

Method CreateExpressionImpl

eval/compiler/cel_expression_builder_flat_impl.cc:83–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83absl::StatusOr<std::unique_ptr<CelExpression>>
84CelExpressionBuilderFlatImpl::CreateExpressionImpl(
85 std::unique_ptr<Ast> converted_ast,
86 std::vector<absl::Status>* warnings) const {
87 std::vector<RuntimeIssue> issues;
88 auto* issues_ptr = (warnings != nullptr) ? &issues : nullptr;
89
90 CEL_ASSIGN_OR_RETURN(FlatExpression impl,
91 flat_expr_builder_.CreateExpressionImpl(
92 std::move(converted_ast), issues_ptr));
93
94 if (issues_ptr != nullptr) {
95 for (const auto& issue : issues) {
96 warnings->push_back(issue.ToStatus());
97 }
98 }
99 if (flat_expr_builder_.options().max_recursion_depth != 0 &&
100 !impl.subexpressions().empty() &&
101 // mainline expression is exactly one recursive step.
102 impl.subexpressions().front().size() == 1 &&
103 impl.subexpressions().front().front()->GetNativeTypeId() ==
104 cel::NativeTypeId::For<WrappedDirectStep>()) {
105 return CelExpressionRecursiveImpl::Create(env_, std::move(impl));
106 }
107
108 return std::make_unique<CelExpressionFlatImpl>(env_, std::move(impl));
109}
110
111} // namespace google::api::expr::runtime

Callers

nothing calls this directly

Calls 5

subexpressionsMethod · 0.80
ToStatusMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
GetNativeTypeIdMethod · 0.45

Tested by

no test coverage detected