| 94 | } |
| 95 | |
| 96 | absl::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. |
no test coverage detected