diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-09-11 09:11:47 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-09-11 09:11:47 +0200 |
| commit | bd2b80d6ac582b9f0bcd96c86d4b79bfdb64eca1 (patch) | |
| tree | a835a5cfe5a9cf48720b9255261e065fd7978849 /boot/materialization.cc | |
| parent | b27872d5c5bfecae74195771f5c1f4e73385b6d6 (diff) | |
| download | elna-bd2b80d6ac582b9f0bcd96c86d4b79bfdb64eca1.tar.gz | |
Implement aligned attribute
Diffstat (limited to 'boot/materialization.cc')
| -rw-r--r-- | boot/materialization.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/boot/materialization.cc b/boot/materialization.cc index 4b58ac2..5b200d5 100644 --- a/boot/materialization.cc +++ b/boot/materialization.cc @@ -33,6 +33,10 @@ namespace elna::boot return "Integer literal overflows"; case real_overflow: return "Real literal overflows"; + case local_export: + return "Local symbols cannot be exported"; + case field_export: + return "Record fields cannot be exported"; } __builtin_unreachable(); } @@ -42,6 +46,43 @@ namespace elna::boot { } + void materialization_visitor::visit(procedure_declaration *declaration) + { + this->in_global_scope = false; + walking_visitor::visit(declaration); + this->in_global_scope = true; + } + + void materialization_visitor::visit(variable_declaration *declaration) + { + walking_visitor::visit(declaration); + for (const auto& variable_identifier : declaration->identifiers) + { + if (!this->in_global_scope && variable_identifier.exported()) + { + add_error<materialization_error>(variable_identifier.id().position(), + materialization_error::kind::local_export); + } + } + } + + void materialization_visitor::visit(record_type_expression *expression) + { + for (const auto& [field_identifiers, field_type] : expression->fields) + { + field_type->accept(this); + + for (const auto& field_identifier : field_identifiers) + { + if (field_identifier.exported()) + { + add_error<materialization_error>(field_identifier.id().position(), + materialization_error::kind::field_export); + } + } + } + } + void materialization_visitor::visit(literal<integer_literal> *literal) { switch (literal->wants_signed) @@ -96,4 +137,11 @@ namespace elna::boot materialization_error::kind::real_overflow); } } + + void materialization_visitor::visit_entry_point(unit *unit) + { + this->in_global_scope = false; + walking_visitor::visit_entry_point(unit); + this->in_global_scope = true; + } } |
