mirror of
https://codeberg.org/ProgramSnail/lang_2023.git
synced 2025-12-06 15:08:45 +00:00
typeclass tree start
This commit is contained in:
parent
c1dec6a0d1
commit
173d50672a
15 changed files with 1475 additions and 35 deletions
|
|
@ -436,6 +436,36 @@ std::optional<utils::IdType> Type::GetFieldType(const std::string& name) const {
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string Type::GetTypeName() const {
|
||||
size_t index = type_.index();
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
return "AbstractType";
|
||||
case 1:
|
||||
return "DefinedType";
|
||||
case 2:
|
||||
return "Builtin";
|
||||
case 3:
|
||||
return "TupleType";
|
||||
case 4:
|
||||
return "VariantType";
|
||||
case 5:
|
||||
return "ReferenceToType";
|
||||
case 6:
|
||||
return "FunctionType";
|
||||
case 7:
|
||||
return "ArrayType";
|
||||
case 8:
|
||||
return "OptionalType";
|
||||
default:
|
||||
// error
|
||||
break;
|
||||
}
|
||||
|
||||
return ""; // ??
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue