aboutsummaryrefslogtreecommitdiff
path: root/boot/result.cc
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-08-28 02:39:42 +0200
committerEugen Wissner <belka@caraus.de>2026-08-28 02:39:42 +0200
commit8e655a0786aec5e0215e09f2a9629c6f32e34793 (patch)
tree0788634cf66fed9c1a1d264b5b8c30da49380559 /boot/result.cc
parent4d4537866690a1ef3d882f5e9a6e01d8220a3650 (diff)
downloadelna-8e655a0786aec5e0215e09f2a9629c6f32e34793.tar.gz
Reject declarations shadowing imports
Diffstat (limited to 'boot/result.cc')
-rw-r--r--boot/result.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/boot/result.cc b/boot/result.cc
index d25b85b..635a121 100644
--- a/boot/result.cc
+++ b/boot/result.cc
@@ -75,6 +75,11 @@ namespace elna::boot
return m_errors;
}
+ const std::deque<std::unique_ptr<diagnostic>>& diagnostic_container::errors() const
+ {
+ return m_errors;
+ }
+
bool diagnostic_container::has_errors() const
{
return !m_errors.empty();
@@ -131,12 +136,13 @@ namespace elna::boot
return this->m_exported;
}
- std::optional<std::pair<std::string, source_position>> previous_declaration_note(
- const std::optional<source_position>& original, std::string_view label)
+ std::optional<diagnostic_note> previous_declaration_note(
+ const std::optional<source_position>& original, std::string_view label,
+ const std::filesystem::path& file)
{
if (original.has_value() && original.value().start().available())
{
- return std::make_pair(std::string(label), original.value());
+ return diagnostic_note{ .message = std::string(label), .position = original.value(), .file = file };
}
else
{
@@ -144,13 +150,13 @@ namespace elna::boot
}
}
- std::optional<std::pair<std::string, source_position>> identifier_list_note(
+ std::optional<diagnostic_note> identifier_list_note(
const std::vector<identifier>& identifiers)
{
auto position_span = source_position(identifiers.front().position().start(),
identifiers.back().position().end());
- return std::make_optional(std::make_pair(join(identifiers), position_span));
+ return diagnostic_note{ .message = join(identifiers), .position = position_span, .file = {} };
}
std::vector<identifier> extract_identifiers(const std::vector<identifier_definition>& identifiers)