mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-18 21:08:44 +00:00
fixes, builtin function fixes, deep copy, string access
This commit is contained in:
parent
3af0772da6
commit
9aaac90ef6
13 changed files with 450 additions and 152 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue