refactor: rename list to array

Closes: #42
This commit is contained in:
2026-07-05 22:41:53 +02:00
parent ee9eadeea8
commit b913fc0c8b
4 changed files with 27 additions and 27 deletions
+3 -3
View File
@@ -167,8 +167,8 @@ void executor::step() {
auto ptr = push_thing({ *m_context->at("core")->type_at(4), m_context, m_context->thing_alloc() });
switch (furvm::thing<>::resolve_type(thing.type(), m_context)->t) {
case type_t::Primitive: ptr->get<std::uintptr_t>() = reinterpret_cast<std::uintptr_t>(thing.raw()); break;
case type_t::List:
ptr->get<std::uintptr_t>() = reinterpret_cast<std::uintptr_t>(thing.get<list_t>().data);
case type_t::Array:
ptr->get<std::uintptr_t>() = reinterpret_cast<std::uintptr_t>(thing.get<array_t>().data);
break;
case type_t::Reference:
case type_t::Import:
@@ -181,7 +181,7 @@ void executor::step() {
auto type = furvm::thing<>::resolve_type(thing.type(), m_context);
switch (type->t) {
case type_t::Primitive: ptr->get<long_t>() = static_cast<long_t>(type->primitive); break;
case type_t::List: ptr->get<long_t>() = thing.get<list_t>().size; break;
case type_t::Array: ptr->get<long_t>() = thing.get<array_t>().size; break;
case type_t::Reference:
case type_t::Import:
default: throw std::runtime_error("unreachable");
+2 -2
View File
@@ -58,7 +58,7 @@ std::ostream& mod::serialize(std::ostream& os) const {
switch (type->t) {
case type_t::Primitive: detail::serialize(os, type->primitive); break;
case type_t::Reference: throw std::runtime_error("reference type serialization is unimplemented");
case type_t::List: detail::serialize(os, type->list.id()); break;
case type_t::Array: detail::serialize(os, type->list.id()); break;
case type_t::Import: {
detail::serialize(os, type->imp.mod);
detail::serialize(os, type->imp.type);
@@ -127,7 +127,7 @@ mod mod::load(std::istream& is) {
mod.emplace_type(id, std::make_shared<class type>(primitive)).dispatch();
} break;
case type_t::Reference: throw std::runtime_error("reference type serialization is unimplemented");
case type_t::List: {
case type_t::Array: {
type_id typeId = 0;
detail::load(is, typeId);
mod.emplace_type(id, std::make_shared<class type>(mod.type_at(typeId))).dispatch();