printing fixes, simple type annotations fix, Function and Array type shortcuts removed, '=' in function definition for block/array removed

This commit is contained in:
ProgramSnail 2024-02-23 16:20:02 +03:00
parent d7f1b6c377
commit d8ef39b2bd
11 changed files with 56 additions and 77 deletions

View file

@ -14,12 +14,6 @@ nodes::TypeProxy build_variant_type(parser::ParseTree::Node parse_node,
nodes::TypeProxy build_tuple_type(parser::ParseTree::Node parse_node,
nodes::TypeStorage &type_storage);
nodes::TypeProxy build_function_type(parser::ParseTree::Node parse_node,
nodes::TypeStorage &type_storage);
nodes::TypeProxy build_array_type(parser::ParseTree::Node parse_node,
nodes::TypeStorage &type_storage);
nodes::TypeProxy build_reference_type(parser::ParseTree::Node parse_node,
nodes::TypeStorage &type_storage);

View file

@ -254,8 +254,15 @@ public:
void append_before(const std::string &name) { value_ = name + "." + value_; }
void append_after(const std::string &name) {
value_ += ".";
value_ += name;
value_ += "." + name;
}
std::pair<Identifier, Identifier> split_first() {
const auto pos = value_.find('.');
if (pos == std::string::npos) {
return {Identifier(*this, type_, ""), *this};
}
return {Identifier(*this, type_, value_.substr(0, pos)), Identifier(*this, type_, value_.substr(pos + 1))}; // '.' is leaved out
}
//

View file

@ -54,8 +54,6 @@ enum class Type {
VARIANT_TYPE,
TUPLE_TYPE,
FUNCTION_TYPE,
ARRAY_TYPE,
REFERENCE_TYPE,
MODIFIED_TYPE,
SIMPLE_TYPE,
@ -150,8 +148,6 @@ const static std::string LAMBDA = "lambda";
const static std::string VARIANT_TYPE = "variant_type";
const static std::string TUPLE_TYPE = "tuple_type";
const static std::string FUNCTION_TYPE = "function_type";
const static std::string ARRAY_TYPE = "array_type";
const static std::string REFERENCE_TYPE = "reference_type";
const static std::string MODIFIED_TYPE = "modified_type";
const static std::string SIMPLE_TYPE = "simple_type";
@ -244,10 +240,6 @@ inline Type string_to_type(const std::string &str) {
return Type::VARIANT_TYPE;
} else if (str == TUPLE_TYPE) {
return Type::TUPLE_TYPE;
} else if (str == FUNCTION_TYPE) {
return Type::FUNCTION_TYPE;
} else if (str == ARRAY_TYPE) {
return Type::ARRAY_TYPE;
} else if (str == REFERENCE_TYPE) {
return Type::REFERENCE_TYPE;
} else if (str == MODIFIED_TYPE) {