Make type_expression abstract
This commit is contained in:
@ -285,31 +285,34 @@ namespace gcc
|
||||
void generic_visitor::visit(source::declaration *declaration)
|
||||
{
|
||||
tree declaration_type = error_mark_node;
|
||||
source::basic_type_expression *basic_type = declaration->type().is_basic();
|
||||
|
||||
if (declaration->type().base() == "Int")
|
||||
gcc_assert(basic_type != nullptr);
|
||||
|
||||
if (basic_type->base() == "Int")
|
||||
{
|
||||
declaration_type = integer_type_node;
|
||||
}
|
||||
else if (declaration->type().base() == "Bool")
|
||||
else if (basic_type->base() == "Bool")
|
||||
{
|
||||
declaration_type = boolean_type_node;
|
||||
}
|
||||
else if (declaration->type().base() == "Float")
|
||||
else if (basic_type->base() == "Float")
|
||||
{
|
||||
declaration_type = double_type_node;
|
||||
}
|
||||
else if (declaration->type().base() == "Char")
|
||||
else if (basic_type->base() == "Char")
|
||||
{
|
||||
declaration_type = elna_char_type_node;
|
||||
}
|
||||
else if (declaration->type().base() == "String")
|
||||
else if (basic_type->base() == "String")
|
||||
{
|
||||
declaration_type = elna_string_type_node;
|
||||
}
|
||||
else
|
||||
{
|
||||
error_at(get_location(&declaration->type().position()),
|
||||
"type '%s' not declared", declaration->type().base().c_str());
|
||||
"type '%s' not declared", basic_type->base().c_str());
|
||||
return;
|
||||
}
|
||||
auto declaration_location = get_location(&declaration->position());
|
||||
|
Reference in New Issue
Block a user