mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-06 06:58:45 +00:00
fixes, new examples
This commit is contained in:
parent
823fa30fa8
commit
7f4266821c
15 changed files with 322 additions and 74 deletions
|
|
@ -43,7 +43,7 @@ public:
|
|||
return graph_id == graph_id_ || typeclass_graph_.GetDependenciesSet(graph_id_).count(graph_id) != 0;
|
||||
}
|
||||
|
||||
std::string ToString() {
|
||||
std::string ToString() const {
|
||||
return "Abstract " + std::to_string(graph_id_);
|
||||
}
|
||||
private:
|
||||
|
|
@ -81,7 +81,7 @@ public:
|
|||
return class_modifier_;
|
||||
}
|
||||
|
||||
std::string ToString() {
|
||||
std::string ToString() const {
|
||||
return "Defined";
|
||||
}
|
||||
private:
|
||||
|
|
@ -178,7 +178,7 @@ public:
|
|||
return fields_;
|
||||
}
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
private:
|
||||
std::optional<std::string> name_;
|
||||
std::vector<std::pair<std::optional<std::string>, utils::IdType>> fields_;
|
||||
|
|
@ -209,7 +209,7 @@ public:
|
|||
current_constructor_ = constructor;
|
||||
}
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
private:
|
||||
std::optional<std::string> name_;
|
||||
std::vector<TupleType> constructors_;
|
||||
|
|
@ -231,7 +231,7 @@ public:
|
|||
std::optional<utils::IdType> GetFieldType(const std::string& name,
|
||||
const std::unordered_set<utils::IdType>& type_namespaces) const;
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
private:
|
||||
utils::IdType type_;
|
||||
TypeManager* type_manager_ = nullptr;
|
||||
|
|
@ -243,7 +243,11 @@ public:
|
|||
ReferenceToType(const std::vector<utils::ReferenceModifier>& references,
|
||||
utils::IdType type,
|
||||
TypeManager* type_manager)
|
||||
: references_(references), type_(type), type_manager_(type_manager) {}
|
||||
: references_(references), type_(type), type_manager_(type_manager) {
|
||||
if (references.empty()) {
|
||||
error_handling::HandleInternalError("ReferenceToType with 0 references", "Type.ReferenceToType", std::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<utils::IdType> InContext(const std::unordered_map<std::string, utils::IdType>& context);
|
||||
bool Same(const ReferenceToType& type) const;
|
||||
|
|
@ -253,7 +257,7 @@ public:
|
|||
std::optional<utils::IdType> GetFieldType(const std::string& name,
|
||||
const std::unordered_set<utils::IdType>& type_namespaces) const;
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
private:
|
||||
std::vector<utils::ReferenceModifier> references_;
|
||||
utils::IdType type_;
|
||||
|
|
@ -278,7 +282,7 @@ public:
|
|||
std::optional<utils::IdType> GetFieldType(const std::string& name,
|
||||
const std::unordered_set<utils::IdType>& type_namespaces) const;
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
private:
|
||||
std::vector<utils::IdType> argument_types_;
|
||||
utils::IdType return_type_;
|
||||
|
|
@ -305,7 +309,7 @@ public:
|
|||
return elements_type_;
|
||||
}
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
private:
|
||||
size_t size_; // = 0 for dynamic
|
||||
utils::IdType elements_type_;
|
||||
|
|
@ -339,7 +343,7 @@ public:
|
|||
return type_;
|
||||
}
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
private:
|
||||
std::variant<AbstractType,
|
||||
DefinedType,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue