Allow extern variables
This commit is contained in:
12
boot/ast.cc
12
boot/ast.cc
@@ -415,11 +415,23 @@ namespace elna::boot
|
||||
{
|
||||
}
|
||||
|
||||
variable_declaration::variable_declaration(const struct position position,
|
||||
std::vector<identifier_definition>&& identifier, std::shared_ptr<type_expression> variable_type,
|
||||
std::monostate)
|
||||
: node(position), m_variable_type(variable_type), identifiers(std::move(identifier)), is_extern(true)
|
||||
{
|
||||
}
|
||||
|
||||
void variable_declaration::accept(parser_visitor *visitor)
|
||||
{
|
||||
visitor->visit(this);
|
||||
}
|
||||
|
||||
bool variable_declaration::has_initializer() const
|
||||
{
|
||||
return this->is_extern || this->body != nullptr;
|
||||
}
|
||||
|
||||
type_expression& variable_declaration::variable_type()
|
||||
{
|
||||
return *m_variable_type;
|
||||
|
Reference in New Issue
Block a user