MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / validateMethod

Method validateMethod

tools/ipc_codegen/ipc_codegen.cpp:491–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

489 }
490
491 void validateMethod(const Method& method) {
492 std::unordered_map<std::string, const Field*> prior;
493 size_t inBlobs = 0;
494 size_t outBlobs = 0;
495 for (const auto& field : method.params) {
496 if (!field.lenRef.empty()) {
497 auto it = prior.find(field.lenRef);
498 if (it == prior.end())
499 fail(field.line, "bytes field '" + field.name +
500 "' references missing or later length field '" + field.lenRef + "'");
501 if (!isIntegral(it->second->type))
502 fail(field.line, "bytes length field '" + field.lenRef + "' must be integral");
503 size_t& count = field.dir == Dir::In ? inBlobs : outBlobs;
504 if (++count > 1)
505 fail(field.line, "only one bytes field per request or response is supported");
506 }
507 prior[field.name] = &field;
508 }
509 }
510
511 void validateFrame(const File& file, const FrameDecl& frame, const char* label) {
512 for (const auto& field : frame.fields) {

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected