| 537 | } |
| 538 | |
| 539 | Expect<ValVariant> Executor::arrayGet(Runtime::StackManager &StackMgr, |
| 540 | const RefVariant &Ref, |
| 541 | const uint32_t TypeIdx, |
| 542 | const uint32_t Idx, |
| 543 | const bool IsSigned) const noexcept { |
| 544 | const auto *Inst = Ref.getPtr<Runtime::Instance::ArrayInstance>(); |
| 545 | if (Inst == nullptr) { |
| 546 | return Unexpect(ErrCode::Value::AccessNullArray); |
| 547 | } |
| 548 | if (Idx >= Inst->getLength()) { |
| 549 | return Unexpect(ErrCode::Value::ArrayOutOfBounds); |
| 550 | } |
| 551 | const auto &VType = getArrayStorageTypeByIdx(StackMgr, TypeIdx); |
| 552 | return unpackVal(VType, Inst->getData(Idx), IsSigned); |
| 553 | } |
| 554 | |
| 555 | Expect<void> Executor::arraySet(Runtime::StackManager &StackMgr, |
| 556 | const RefVariant &Ref, const ValVariant &Val, |