mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-27 17:28:45 +00:00
fixes, parametrized type constructor not fork (segfault)
This commit is contained in:
parent
7f4266821c
commit
91f9affadc
8 changed files with 89 additions and 58 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
// for clangd
|
||||
#include "error_handling.hpp"
|
||||
#include "interpreter_tree.hpp"
|
||||
#include "typeclass_graph.hpp"
|
||||
#include "types.hpp"
|
||||
|
|
@ -211,8 +212,11 @@ private:
|
|||
|
||||
void VisitDefinedType(info::definition::AnyType* defined_type,
|
||||
const std::unordered_map<std::string, utils::IdType>& context,
|
||||
utils::ValueType modifier) {
|
||||
context_manager_.EnterContext();
|
||||
utils::ValueType modifier,
|
||||
bool make_scoped) {
|
||||
if (make_scoped) {
|
||||
context_manager_.EnterContext();
|
||||
}
|
||||
AddTypeParameterLocalTypes(defined_type);
|
||||
Visitor::Visit(defined_type->node->value);
|
||||
current_type_ = TypeInContext(current_type_, context);
|
||||
|
|
@ -222,7 +226,9 @@ private:
|
|||
defined_type->modifier,
|
||||
context_manager_.GetValueManager()),
|
||||
modifier);
|
||||
context_manager_.ExitContext();
|
||||
if (make_scoped) {
|
||||
context_manager_.ExitContext();
|
||||
}
|
||||
}
|
||||
|
||||
void AddTypeParameterLocalTypes(info::definition::AnyType* type_info) {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
}
|
||||
|
||||
std::string ToString() const {
|
||||
return "Abstract " + std::to_string(graph_id_);
|
||||
return "Abstract " + std::to_string(graph_id_) + " ( " + typeclass_graph_.GetVertex(graph_id_).name + " )";
|
||||
}
|
||||
private:
|
||||
utils::AbstractTypeModifier modifier_;
|
||||
|
|
@ -81,9 +81,7 @@ public:
|
|||
return class_modifier_;
|
||||
}
|
||||
|
||||
std::string ToString() const {
|
||||
return "Defined";
|
||||
}
|
||||
std::string ToString() const;
|
||||
private:
|
||||
utils::IdType type_id_; // in defined types
|
||||
utils::IdType type_; // in types manager, created using context types (if specific type)
|
||||
|
|
@ -374,7 +372,7 @@ public:
|
|||
if (!std::holds_alternative<T>(types_.at(type_id).first.GetType())) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return &std::get<T>(types_.at(type_id).first.GetType());
|
||||
return &std::get<T>(types_[type_id].first.GetType());
|
||||
}
|
||||
|
||||
Type* GetAnyValue(utils::IdType type_id) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue