Skip parameter names in procedure type expressions
This commit is contained in:
231
boot/ast.cc
231
boot/ast.cc
@ -17,175 +17,8 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#include "elna/boot/ast.h"
|
||||
|
||||
namespace elna
|
||||
namespace elna::boot
|
||||
{
|
||||
namespace boot
|
||||
{
|
||||
void empty_visitor::visit(variable_declaration *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(constant_definition *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(procedure_definition *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(type_definition *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(procedure_call *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(traits_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(cast_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(assign_statement *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(if_statement *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(while_statement *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(return_statement *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(defer_statement *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(block *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(program *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(binary_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(unary_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(primitive_type_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(array_type_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(pointer_type_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(record_type_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(union_type_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(procedure_type_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(variable_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(array_access_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(field_access_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(dereference_expression *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(number_literal<std::int32_t> *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(number_literal<std::uint32_t> *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(number_literal<double> *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(number_literal<bool> *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(number_literal<unsigned char> *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(number_literal<std::nullptr_t> *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void empty_visitor::visit(number_literal<std::string> *)
|
||||
{
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
node::node(const struct position position)
|
||||
: source_position(position)
|
||||
{
|
||||
@ -305,7 +138,7 @@ namespace boot
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
literal *expression::is_literal()
|
||||
literal_expression *expression::is_literal()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@ -336,7 +169,7 @@ namespace boot
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
else if (literal *node = is_literal())
|
||||
else if (literal_expression *node = is_literal())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
@ -518,7 +351,7 @@ namespace boot
|
||||
}
|
||||
|
||||
constant_definition::constant_definition(const struct position position, const std::string& identifier,
|
||||
const bool exported, literal *body)
|
||||
const bool exported, literal_expression *body)
|
||||
: definition(position, identifier, exported), m_body(body)
|
||||
{
|
||||
}
|
||||
@ -528,7 +361,7 @@ namespace boot
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
literal& constant_definition::body()
|
||||
literal_expression& constant_definition::body()
|
||||
{
|
||||
return *m_body;
|
||||
}
|
||||
@ -538,14 +371,19 @@ namespace boot
|
||||
delete m_body;
|
||||
}
|
||||
|
||||
procedure_type_expression::procedure_type_expression(const struct position position,
|
||||
std::shared_ptr<type_expression> return_type)
|
||||
: type_expression(position), return_type(return_type), no_return(false)
|
||||
return_declaration::return_declaration(std::shared_ptr<type_expression> type)
|
||||
: type(type)
|
||||
{
|
||||
}
|
||||
|
||||
procedure_type_expression::procedure_type_expression(const struct position position, no_return_t)
|
||||
: type_expression(position), return_type(nullptr), no_return(true)
|
||||
return_declaration::return_declaration(std::monostate)
|
||||
: no_return(true)
|
||||
{
|
||||
}
|
||||
|
||||
procedure_type_expression::procedure_type_expression(const struct position position,
|
||||
return_declaration return_type)
|
||||
: type_expression(position), return_type(return_type)
|
||||
{
|
||||
}
|
||||
|
||||
@ -554,14 +392,6 @@ namespace boot
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
procedure_type_expression::~procedure_type_expression()
|
||||
{
|
||||
for (auto parameter : this->parameters)
|
||||
{
|
||||
delete parameter;
|
||||
}
|
||||
}
|
||||
|
||||
procedure_definition::procedure_definition(const struct position position, const std::string& identifier,
|
||||
const bool exported, std::shared_ptr<procedure_type_expression> heading, block *body)
|
||||
: definition(position, identifier, exported), m_heading(heading), body(body)
|
||||
@ -652,42 +482,42 @@ namespace boot
|
||||
}
|
||||
}
|
||||
|
||||
literal::literal()
|
||||
literal_expression::literal_expression()
|
||||
{
|
||||
}
|
||||
|
||||
literal *literal::is_literal()
|
||||
literal_expression *literal_expression::is_literal()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
void literal::accept(parser_visitor *visitor)
|
||||
void literal_expression::accept(parser_visitor *visitor)
|
||||
{
|
||||
if (number_literal<std::int32_t> *node = is_int())
|
||||
if (literal<std::int32_t> *node = is_int())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
else if (number_literal<std::uint32_t> *node = is_word())
|
||||
else if (literal<std::uint32_t> *node = is_word())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
else if (number_literal<double> *node = is_float())
|
||||
else if (literal<double> *node = is_float())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
else if (number_literal<bool> *node = is_bool())
|
||||
else if (literal<bool> *node = is_bool())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
else if (number_literal<unsigned char> *node = is_char())
|
||||
else if (literal<unsigned char> *node = is_char())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
else if (number_literal<std::nullptr_t> *node = is_nil())
|
||||
else if (literal<std::nullptr_t> *node = is_nil())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
else if (number_literal<std::string> *node = is_string())
|
||||
else if (literal<std::string> *node = is_string())
|
||||
{
|
||||
return node->accept(visitor);
|
||||
}
|
||||
@ -991,9 +821,8 @@ namespace boot
|
||||
delete m_value;
|
||||
}
|
||||
|
||||
traits_expression::traits_expression(const struct position position,
|
||||
const std::string& name, std::shared_ptr<type_expression> type)
|
||||
: node(position), m_type(type), name(name)
|
||||
traits_expression::traits_expression(const struct position position, const std::string& name)
|
||||
: node(position), name(name)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1007,11 +836,6 @@ namespace boot
|
||||
return this;
|
||||
}
|
||||
|
||||
type_expression& traits_expression::type()
|
||||
{
|
||||
return *m_type;
|
||||
}
|
||||
|
||||
conditional_statements::conditional_statements(expression *prerequisite)
|
||||
: m_prerequisite(prerequisite)
|
||||
{
|
||||
@ -1212,4 +1036,3 @@ namespace boot
|
||||
__builtin_unreachable();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user