feat(furvm): introduce slice type

Refs: #63
This commit is contained in:
2026-09-03 23:55:31 +02:00
parent 977b22d8f5
commit fe37bf8058
4 changed files with 112 additions and 19 deletions
+8
View File
@@ -30,6 +30,14 @@ static void print_thing(const furvm::thing<>& thing) {
}
std::cout << " }";
break;
case thing_type::Slice:
std::cout << "Slice [" << thing.length() << "] { ";
for (thing_type::u64 i = 0; i < thing.length(); ++i) {
if (i > 0) std::cout << ", ";
print_thing(thing.at(i));
}
std::cout << " }";
break;
default: std::cerr << "{Type not recognized}";
}
}
+8
View File
@@ -54,6 +54,9 @@ std::ostream& mod::serialize(std::ostream& os) const {
detail::serialize(os, type.value.array.typeId);
detail::serialize(os, type.value.array.size);
} break;
case mod_type::Slice: {
detail::serialize(os, type.value.slice.typeId);
} break;
case mod_type::Import: {
detail::serialize(os, type.value.imprt.modId);
detail::serialize(os, type.value.imprt.typeId);
@@ -169,6 +172,11 @@ mod mod::load(std::istream& is) {
detail::load(is, size);
mod.emplace_type(id, typeId, size).dispatch();
} break;
case mod_type::Slice: {
mod_type_id typeId = 0;
detail::load(is, typeId);
mod.emplace_type(id, mod_type::Slice, typeId).dispatch();
} break;
case mod_type::Import: {
std::string modName;
detail::load(is, modName);