Allow extern variables

This commit is contained in:
2025-08-20 21:47:50 +02:00
parent 0c2a396320
commit 809e41bcc3
8 changed files with 45 additions and 12 deletions

View File

@@ -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;