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

Method PostVisitStruct

eval/compiler/flat_expr_builder.cc:1545–1579  ·  view source on GitHub ↗

CreateStruct node handler. Invoked after child nodes are processed.

Source from the content-addressed store, hash-verified

1543 // CreateStruct node handler.
1544 // Invoked after child nodes are processed.
1545 void PostVisitStruct(const cel::Expr& expr,
1546 const cel::StructExpr& struct_expr) override {
1547 if (!progress_status_.ok()) {
1548 return;
1549 }
1550
1551 auto status_or_resolved_fields =
1552 ResolveCreateStructFields(struct_expr, expr.id());
1553 if (!status_or_resolved_fields.ok()) {
1554 SetProgressStatusError(status_or_resolved_fields.status());
1555 return;
1556 }
1557 std::string resolved_name =
1558 std::move(status_or_resolved_fields.value().first);
1559 std::vector<std::string> fields =
1560 std::move(status_or_resolved_fields.value().second);
1561
1562 if (auto depth = RecursionEligible(); depth.has_value()) {
1563 auto deps = ExtractRecursiveDependencies();
1564 if (deps.size() != struct_expr.fields().size()) {
1565 SetProgressStatusError(absl::InternalError(
1566 "Unexpected number of plan elements for CreateStruct expr"));
1567 return;
1568 }
1569 auto step = CreateDirectCreateStructStep(
1570 std::move(resolved_name), std::move(fields), std::move(deps),
1571 MakeOptionalIndicesSet(struct_expr), expr.id());
1572 SetRecursiveStep(std::move(step), *depth + 1);
1573 return;
1574 }
1575
1576 AddStep(CreateCreateStructStep(std::move(resolved_name), std::move(fields),
1577 MakeOptionalIndicesSet(struct_expr),
1578 expr.id()));
1579 }
1580
1581 void PostVisitMap(const cel::Expr& expr,
1582 const cel::MapExpr& map_expr) override {

Callers

nothing calls this directly

Calls 8

CreateCreateStructStepFunction · 0.85
MakeOptionalIndicesSetFunction · 0.70
okMethod · 0.45
idMethod · 0.45
valueMethod · 0.45
has_valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected