refactor: make context inherit module handle container

Refs: #39
This commit is contained in:
2026-07-03 19:28:59 +02:00
parent e087c11008
commit a7ab214ce3
4 changed files with 5 additions and 48 deletions
+2 -2
View File
@@ -23,12 +23,12 @@ static constexpr std::array<furvm::byte, 9> s_bytecode = {
int main(void) {
auto context = std::make_shared<furvm::context>();
furvm::mod_h furlangModule = context->emplace_module("furlang");
furvm::mod_h furlangModule = context->emplace("furlang");
furvm::function_h printFunc = furlangModule->emplace_function("print", 1, "print");
furlangModule->set_native_function("print",
[](furvm::executor& executor) { std::cout << executor.load_thing(0)->integer() << '\n'; });
furvm::mod_h mainModule = context->emplace_module("main", s_bytecode.begin(), s_bytecode.end());
furvm::mod_h mainModule = context->emplace("main", s_bytecode.begin(), s_bytecode.end());
furvm::function_h mainFunc = mainModule->emplace_function("main", 0, 0);
mainModule->emplace_function(furlangModule, printFunc).dispatch();