trying to fix basic types local types

This commit is contained in:
ProgramSnail 2023-05-22 21:00:43 +03:00
parent 25583d3edd
commit 24ff9a30d8
8 changed files with 132 additions and 54 deletions

View file

@ -160,6 +160,16 @@ private:
return maybe_internal_value_info.value();
}
utils::IdType GraphIdByTypeId(utils::IdType type_id) {
auto maybe_any_type = global_info_.GetTypeInfo<info::definition::AnyType>(type_id);
if (!maybe_any_type.has_value()) {
error_handling::HandleInternalError("Only AnyType implemented",
"ExecuteVisitor.ExtractInternalValue",
std::nullopt);
}
return maybe_any_type.value()->node->definition->type->graph_id_;
}
//
bool HandleBuiltinFunctionCall(FunctionCallExpression* node);
@ -170,7 +180,9 @@ private:
info::GlobalInfo& global_info_;
info::TypeclassGraph& typeclass_graph_;
info::ContextManager<info::type::Type, info::type::TypeManager>& type_context_manager_;
info::ContextManager<info::value::Value, info::value::ValueManager>& context_manager_;
// local types store types graph ids
utils::IdType current_value_;
std::optional<LoopControlExpression> active_loop_control_expression_;

View file

@ -32,6 +32,7 @@ public:
std::unordered_map<std::string, FunctionInfo> functions;
std::unordered_set<std::string> dependencies; // TODO: parameters
interpreter::tokens::BaseNode* base_node; // for error handling
std::optional<utils::IdType> type_id; // for defined types
Modifier modifier;
};