mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-18 21:08:44 +00:00
fixes, new examples
This commit is contained in:
parent
823fa30fa8
commit
7f4266821c
15 changed files with 322 additions and 74 deletions
|
|
@ -120,13 +120,13 @@ std::optional<utils::IdType> TupleType::GetFieldType(const std::string& name,
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string TupleType::ToString() {
|
||||
std::string TupleType::ToString() const {
|
||||
std::string result;
|
||||
|
||||
result += "(";
|
||||
|
||||
for (auto& field : fields_) {
|
||||
result += "& ";
|
||||
result += " & ";
|
||||
result += type_manager_->GetAnyValue(field.second)->ToString();
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ std::optional<utils::IdType> VariantType::GetFieldType(const std::string& name,
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string VariantType::ToString() {
|
||||
std::string VariantType::ToString() const {
|
||||
std::string result;
|
||||
|
||||
result += "(";
|
||||
|
|
@ -229,7 +229,7 @@ std::optional<utils::IdType> OptionalType::GetFieldType(const std::string&,
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string OptionalType::ToString() {
|
||||
std::string OptionalType::ToString() const {
|
||||
return "Optional " + type_manager_->GetAnyValue(type_)->ToString();
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ std::optional<utils::IdType> ReferenceToType::GetFieldType(const std::string& na
|
|||
}
|
||||
|
||||
|
||||
std::string ReferenceToType::ToString() {
|
||||
std::string ReferenceToType::ToString() const {
|
||||
std::string result;
|
||||
|
||||
for (auto& reference : references_) {
|
||||
|
|
@ -337,7 +337,7 @@ std::optional<utils::IdType> FunctionType::GetFieldType(const std::string&,
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string FunctionType::ToString() {
|
||||
std::string FunctionType::ToString() const {
|
||||
std::string result;
|
||||
|
||||
result += "(";
|
||||
|
|
@ -387,7 +387,7 @@ std::optional<utils::IdType> ArrayType::GetFieldType(const std::string&,
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string ArrayType::ToString() {
|
||||
std::string ArrayType::ToString() const {
|
||||
return "Array (" + std::to_string(size_) + ") " + type_manager_->GetAnyValue(elements_type_)->ToString();
|
||||
}
|
||||
|
||||
|
|
@ -554,7 +554,7 @@ std::string Type::GetTypeName() const {
|
|||
return ""; // ??
|
||||
}
|
||||
|
||||
std::string Type::ToString() {
|
||||
std::string Type::ToString() const {
|
||||
size_t index = type_.index();
|
||||
|
||||
switch (index) {
|
||||
|
|
@ -562,7 +562,7 @@ std::string Type::ToString() {
|
|||
return std::get<AbstractType>(type_).ToString();
|
||||
case 1:
|
||||
return std::get<DefinedType>(type_).ToString();
|
||||
case 2:
|
||||
case 2: // ??
|
||||
return ::info::type::ToString(std::get<InternalType>(type_));
|
||||
case 3:
|
||||
return std::get<TupleType>(type_).ToString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue