feat: add return type to function

Closes: #51
This commit is contained in:
2026-07-13 17:28:22 +02:00
parent 9b280fab22
commit ff3fce53f5
4 changed files with 23 additions and 9 deletions
+3 -1
View File
@@ -5,6 +5,7 @@
#include "furvm/module.hpp" // IWYU pragma: keep
#include "furvm/thing.hpp" // IWYU pragma: keep
#include <optional>
#include <stack>
#include <utility>
#include <vector>
@@ -40,7 +41,8 @@ public:
std::size_t position; /**< Cursor to a current instruction in the bytecode. */
std::size_t stackBase; /**< Snapshot of the stack size before this frame. */
std::vector<thing_h> variables; /**< Frame variables. */
thing_type* returnType; /**< Return type. */
std::vector<thing_h> variables; /**< Frame variables. */
};
public:
/**
+3 -1
View File
@@ -6,6 +6,7 @@
#include "furvm/handle.hpp" // IWYU pragma: keep
#include <cstdint>
#include <optional>
#include <stdexcept>
#include <string>
#include <type_traits>
@@ -37,7 +38,8 @@ struct import_function {
* @brief Function signature.
*/
struct function_sig {
std::vector<mod_type_h> params;
std::vector<mod_type_h> params;
std::optional<mod_type_h> returnType;
bool operator==(const function_sig& rhs) const { return params == rhs.params; }