MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / validateCanonLower

Method validateCanonLower

lib/validator/component_validator.cpp:1311–1331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1309}
1310
1311Expect<void>
1312Validator::validateCanonLower(const AST::Component::Canonical &Canon) noexcept {
1313 const uint32_t FuncIdx = Canon.getIndex();
1314 const uint32_t FuncSpaceSize =
1315 CompCtx.getSortIndexSize(AST::Component::Sort::SortType::Func);
1316 // 1. Component func index bounds.
1317 if (FuncIdx >= FuncSpaceSize) {
1318 spdlog::error(ErrCode::Value::InvalidIndex);
1319 spdlog::error(
1320 " canon lower: component func index {} exceeds func index space size {}"sv,
1321 FuncIdx, FuncSpaceSize);
1322 spdlog::error(ErrInfo::InfoAST(ASTNodeAttr::Comp_Canonical));
1323 return Unexpect(ErrCode::Value::InvalidIndex);
1324 }
1325 // 2. Validate canonical options (per-site rules for Lower).
1326 EXPECTED_TRY(validateCanonOptions(Canon.getOpCode(), Canon.getOptions()));
1327 // 3. Allocate the resulting core func. Full ABI signature synthesis
1328 // (flatten_functype for lower) deferred as GAP-C-2b.
1329 CompCtx.addCoreFunc();
1330 return {};
1331}
1332
1333Expect<void> Validator::validateCanonResourceNew(
1334 const AST::Component::Canonical &Canon) noexcept {

Callers

nothing calls this directly

Calls 9

InfoASTClass · 0.85
UnexpectFunction · 0.85
getOptionsMethod · 0.80
addCoreFuncMethod · 0.80
errorFunction · 0.50
EXPECTED_TRYFunction · 0.50
getIndexMethod · 0.45
getSortIndexSizeMethod · 0.45
getOpCodeMethod · 0.45

Tested by

no test coverage detected