MCPcopy Create free account
hub / github.com/chigraph/chigraph / validateFunctionNodeInputs

Function validateFunctionNodeInputs

libchigraph/src/FunctionValidator.cpp:191–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189} // anonymous namespace
190
191Result validateFunctionNodeInputs(const GraphFunction& func) {
192 Result res;
193
194 // make sure they all get the context
195 auto funcCtx =
196 res.addScopedContext({{"function", func.name()}, {"module", func.module().fullName()}});
197
198 auto entry = func.entryNode();
199
200 if (entry == nullptr) {
201 return res;
202 // TODO: should this be an error?
203 }
204
205 std::unordered_map<const NodeInstance*, std::vector<int>> alreadyCalled;
206 alreadyCalled.emplace(entry, std::vector<int>{});
207
208 // no need to create a processed because you can't create a loop with entry in it
209
210 for (const auto& conn : entry->outputExecConnections) {
211 if (conn.first == nullptr) { continue; }
212 res += validatePath(*conn.first, conn.second, alreadyCalled);
213 }
214
215 return res;
216}
217
218Result validateFunctionExecOutputs(const GraphFunction& func) {
219 // make sure all exec outputs exist, and raise an error otherwise.

Callers 1

validateFunctionFunction · 0.85

Calls 5

validatePathFunction · 0.85
addScopedContextMethod · 0.80
fullNameMethod · 0.80
entryNodeMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected