Replace build_type with visitor functions
This commit is contained in:
60
boot/ast.cc
60
boot/ast.cc
@ -239,36 +239,6 @@ namespace boot
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<basic_type> top_type::is_basic()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<array_type> top_type::is_array()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<record_type> top_type::is_record()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<union_type> top_type::is_union()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<pointer_type> top_type::is_pointer()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<procedure_type> top_type::is_procedure()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
basic_type::basic_type(const struct position position, const std::string& name)
|
||||
: top_type(position), m_name(name)
|
||||
{
|
||||
@ -284,11 +254,6 @@ namespace boot
|
||||
return m_name;
|
||||
}
|
||||
|
||||
std::shared_ptr<basic_type> basic_type::is_basic()
|
||||
{
|
||||
return std::static_pointer_cast<basic_type>(shared_from_this());
|
||||
}
|
||||
|
||||
array_type::array_type(const struct position position, std::shared_ptr<top_type> base, const std::uint32_t size)
|
||||
: top_type(position), m_base(base), size(size)
|
||||
{
|
||||
@ -304,11 +269,6 @@ namespace boot
|
||||
return *m_base;
|
||||
}
|
||||
|
||||
std::shared_ptr<array_type> array_type::is_array()
|
||||
{
|
||||
return std::static_pointer_cast<array_type>(shared_from_this());
|
||||
}
|
||||
|
||||
pointer_type::pointer_type(const struct position position, std::shared_ptr<top_type> base)
|
||||
: top_type(position), m_base(base)
|
||||
{
|
||||
@ -324,11 +284,6 @@ namespace boot
|
||||
return *m_base;
|
||||
}
|
||||
|
||||
std::shared_ptr<pointer_type> pointer_type::is_pointer()
|
||||
{
|
||||
return std::static_pointer_cast<pointer_type>(shared_from_this());
|
||||
}
|
||||
|
||||
record_type::record_type(const struct position position, fields_t&& fields)
|
||||
: top_type(position), fields(std::move(fields))
|
||||
{
|
||||
@ -339,21 +294,11 @@ namespace boot
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
std::shared_ptr<record_type> record_type::is_record()
|
||||
{
|
||||
return std::static_pointer_cast<record_type>(shared_from_this());
|
||||
}
|
||||
|
||||
union_type::union_type(const struct position position, fields_t&& fields)
|
||||
: top_type(position), fields(std::move(fields))
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<union_type> union_type::is_union()
|
||||
{
|
||||
return std::static_pointer_cast<union_type>(shared_from_this());
|
||||
}
|
||||
|
||||
void union_type::accept(parser_visitor *visitor)
|
||||
{
|
||||
visitor->visit(this);
|
||||
@ -416,11 +361,6 @@ namespace boot
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
std::shared_ptr<procedure_type> procedure_type::is_procedure()
|
||||
{
|
||||
return std::static_pointer_cast<procedure_type>(shared_from_this());
|
||||
}
|
||||
|
||||
procedure_type::~procedure_type()
|
||||
{
|
||||
for (auto parameter : this->parameters)
|
||||
|
Reference in New Issue
Block a user