feat(furvm): introduce length of operator

Closes: #54
This commit is contained in:
2026-07-11 23:17:59 +02:00
parent cd715ae779
commit e1b75ccc8e
4 changed files with 19 additions and 7 deletions
+5
View File
@@ -125,6 +125,11 @@ enum class instruction_t : byte {
*/
Sizeof,
/**
* @brief Pushes a length of popped-off thing onto the stack.
*/
Lengthof,
/**
* @brief Pushes a variable onto the stack.
*
+1 -1
View File
@@ -453,7 +453,7 @@ public:
return { *m_type.value.array.type, data + (index * elementSize), m_allocator };
}
std::size_t size() const {
thing_type::u64 length() const {
if (m_type.type != thing_type::Array) throw bad_thing_access();
return m_type.value.array.size == 0 ? get<array>().dynamic.size : m_type.value.array.size;
}