fixes, refactoring (shorter names, visitor)

This commit is contained in:
ProgramSnail 2024-05-01 14:05:29 +03:00
parent 57b1172a4f
commit f58bfd938c
20 changed files with 564 additions and 764 deletions

View file

@ -5,7 +5,33 @@
#include "basic_nodes.hpp"
namespace builtin::types {
namespace builtin {
enum class Type {
// -- containers
TUPLE,
VARIANT,
FUNCTION,
ARRAY,
OPTIONAL,
RESULT,
ERROR,
// -- basic types
FLOAT,
DOUBLE,
INT,
LONG,
INDEX,
CHAR,
UNICODE,
BOOL,
UNIT,
NULL_OPTION,
// -- none
NONE,
};
namespace types {
// -- containers
@ -50,30 +76,6 @@ const static std::string NULL_OPTION_IDENTIFIER = "Null";
//
enum class Type {
// -- containers
TUPLE,
VARIANT,
FUNCTION,
ARRAY,
OPTIONAL,
RESULT,
ERROR,
// -- basic types
FLOAT,
DOUBLE,
INT,
LONG,
INDEX,
CHAR,
UNICODE,
BOOL,
UNIT,
NULL_OPTION,
// -- none
NONE,
};
inline std::string to_string(Type type) {
switch (type) {
// -- containers
@ -202,4 +204,6 @@ inline std::optional<size_t> get_parameters_count(Type type) {
exit(1); // unreachable
}
} // namespace builtin::types
} // namespace types
} // namespace builtin