Retrieve an array element, returning false if the index is out of bounds Caller must have a read lock on heapLock before calling this!
| 124 | // Retrieve an array element, returning false if the index is out of bounds |
| 125 | // Caller must have a read lock on heapLock before calling this! |
| 126 | bool ArrayHandle::GetElement(size_t index, ExpressionValue &rslt) const noexcept |
| 127 | { |
| 128 | #if CHECK_HEAP_LOCKED |
| 129 | Heap::heapLock.CheckHasReadOrWriteLock(); |
| 130 | #endif |
| 131 | if (slotPtr != nullptr) |
| 132 | { |
| 133 | #if CHECK_HANDLES |
| 134 | Heap::CheckSlotGood(slotPtr); |
| 135 | #endif |
| 136 | const Heap::StorageSpace *const _ecv_null storage = slotPtr->storage; |
| 137 | if (storage != nullptr) |
| 138 | { |
| 139 | const ArrayStorageSpace *const aSpace = reinterpret_cast<const ArrayStorageSpace*>(_ecv_not_null(storage)); |
| 140 | if (index < aSpace->count) |
| 141 | { |
| 142 | rslt = aSpace->elements[index]; |
| 143 | return true; |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | return false; |
| 148 | } |
| 149 | |
| 150 | // Retrieve the type of an array element, or TypeCode::None if the index is out of range |
| 151 | // Caller must have a read lock on heapLock before calling this! |
no outgoing calls
no test coverage detected