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

Function CreateRecursiveProgram

eval/eval/create_map_step_test.cc:96–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96absl::StatusOr<ExecutionPath> CreateRecursiveProgram(
97 const std::vector<std::pair<CelValue, CelValue>>& values,
98 Activation& activation) {
99 ExecutionPath path;
100
101 int index = 0;
102 std::vector<std::unique_ptr<DirectExpressionStep>> deps;
103 for (const auto& item : values) {
104 std::string key_name = absl::StrCat("key", index);
105 std::string value_name = absl::StrCat("value", index);
106
107 deps.push_back(CreateDirectIdentStep(key_name, -1));
108
109 deps.push_back(CreateDirectIdentStep(value_name, -1));
110
111 activation.InsertValue(key_name, item.first);
112 activation.InsertValue(value_name, item.second);
113
114 index++;
115 }
116 path.push_back(std::make_unique<WrappedDirectStep>(
117 CreateDirectCreateMapStep(std::move(deps), {}, -1), -1));
118
119 return path;
120}
121
122// Helper method. Creates simple pipeline containing CreateStruct step that
123// builds Map and runs it.

Callers 1

RunCreateMapExpressionFunction · 0.85

Calls 3

CreateDirectIdentStepFunction · 0.85
InsertValueMethod · 0.80

Tested by

no test coverage detected