| 1409 | } |
| 1410 | |
| 1411 | Expect<void> Validator::validateCanonResourceDrop( |
| 1412 | const AST::Component::Canonical &Canon) noexcept { |
| 1413 | const uint32_t Idx = Canon.getIndex(); |
| 1414 | const uint32_t TypeSpaceSize = |
| 1415 | CompCtx.getSortIndexSize(AST::Component::Sort::SortType::Type); |
| 1416 | // 1. Type index bounds. |
| 1417 | if (Idx >= TypeSpaceSize) { |
| 1418 | spdlog::error(ErrCode::Value::InvalidIndex); |
| 1419 | spdlog::error( |
| 1420 | " canon resource.drop: type index {} exceeds type index space size {}"sv, |
| 1421 | Idx, TypeSpaceSize); |
| 1422 | spdlog::error(ErrInfo::InfoAST(ASTNodeAttr::Comp_Canonical)); |
| 1423 | return Unexpect(ErrCode::Value::InvalidIndex); |
| 1424 | } |
| 1425 | // 2. Type must be a resource type. |
| 1426 | if (!CompCtx.isResourceType(Idx)) { |
| 1427 | spdlog::error(ErrCode::Value::InvalidTypeReference); |
| 1428 | spdlog::error( |
| 1429 | " canon resource.drop: type index {} does not reference a resource"sv, |
| 1430 | Idx); |
| 1431 | spdlog::error(ErrInfo::InfoAST(ASTNodeAttr::Comp_Canonical)); |
| 1432 | return Unexpect(ErrCode::Value::InvalidTypeReference); |
| 1433 | } |
| 1434 | // 3. resource.drop accepts both local and imported resources — no locality |
| 1435 | // check. |
| 1436 | // 4. Validate canonical options. |
| 1437 | EXPECTED_TRY(validateCanonOptions(Canon.getOpCode(), Canon.getOptions())); |
| 1438 | // 5. Allocate the resulting core func. Full signature tracking deferred. |
| 1439 | CompCtx.addCoreFunc(); |
| 1440 | return {}; |
| 1441 | } |
| 1442 | |
| 1443 | Expect<void> Validator::validate(const AST::Component::Import &Im) noexcept { |
| 1444 | // Validation steps: |
nothing calls this directly
no test coverage detected