feat: introduce reference instruction

This commit is contained in:
2026-07-01 21:58:33 +02:00
parent 09252c3ec3
commit 6ec4710eaa
4 changed files with 15 additions and 3 deletions
+7
View File
@@ -40,6 +40,13 @@ enum class instruction_t : byte {
*/
Clone,
/**
* @brief Pushes a new reference onto the stack.
*
* Pops the top thing from the stack and pushes its reference.
*/
Reference,
/**
* @brief Adds two things together on the stack.
*/
+1 -1
View File
@@ -368,7 +368,7 @@ public:
}
thing reference() const {
thing res = { std::make_shared<type>({ m_type }), m_allocator };
thing res = { std::make_shared<class type>(m_type), m_allocator };
res.get<reference_t>() = m_data;
return std::move(res);
}