fixes, builtin function fixes, deep copy, string access

This commit is contained in:
ProgramSnail 2023-05-22 16:03:50 +03:00
parent 3af0772da6
commit 9aaac90ef6
13 changed files with 450 additions and 152 deletions

View file

@ -5,7 +5,7 @@
namespace info::type {
std::optional<utils::IdType> AbstractType::InContext(const std::unordered_map<std::string, utils::IdType>& context) {
auto type_iter = context.find(name_);
auto type_iter = context.find(typeclass_graph_.GetVertex(graph_id_).name);
if (type_iter != context.end()) {
return type_iter->second;
@ -14,12 +14,15 @@ std::optional<utils::IdType> AbstractType::InContext(const std::unordered_map<st
}
bool AbstractType::Same(const AbstractType& type) const {
return name_ == type.name_;
return graph_id_ == type.graph_id_;
}
bool AbstractType::operator<(const AbstractType& type) const {
for (auto& graph_id : requirement_graph_ids_) {
if (type.requirement_graph_ids_.count(graph_id) == 0) {
bool AbstractType::operator<(const AbstractType& type) const { // TODO: cache DependenciesSet
auto requirement_graph_ids = typeclass_graph_.GetDependenciesSet(graph_id_);
auto other_requirement_graph_ids = type.typeclass_graph_.GetDependenciesSet(type.graph_id_);
for (auto& graph_id : requirement_graph_ids) {
if (other_requirement_graph_ids.count(graph_id) == 0) {
return false;
}
}