AST Component::ResourceType node.
| 434 | |
| 435 | /// AST Component::ResourceType node. |
| 436 | class ResourceType { |
| 437 | public: |
| 438 | ResourceType() noexcept : DtorSync(true) {} |
| 439 | ResourceType(bool Sync) noexcept : DtorSync(Sync) {} |
| 440 | |
| 441 | std::optional<uint32_t> getDestructor() const noexcept { return Dtor; } |
| 442 | std::optional<uint32_t> getCallback() const noexcept { return DtorCallback; } |
| 443 | |
| 444 | bool IsSync() noexcept { return DtorSync; } |
| 445 | std::optional<uint32_t> &getDestructor() noexcept { return Dtor; } |
| 446 | std::optional<uint32_t> &getCallback() noexcept { return DtorCallback; } |
| 447 | |
| 448 | bool isAddrI64() const noexcept { return AddrI64; } |
| 449 | void setAddrI64(bool V) noexcept { AddrI64 = V; } |
| 450 | |
| 451 | private: |
| 452 | // Destructor is sync or not. True for sync, false for async. |
| 453 | bool DtorSync; |
| 454 | // Resource address width. False = i32 (0x7f), true = i64 (0x7e, memory64 |
| 455 | // proposal). |
| 456 | bool AddrI64 = false; |
| 457 | // Destructor function index. |
| 458 | std::optional<uint32_t> Dtor; |
| 459 | // Destructor callback function index. |
| 460 | std::optional<uint32_t> DtorCallback; |
| 461 | }; |
| 462 | |
| 463 | // ============================================================================= |
| 464 | // Part 7: Type definition. |