aboutsummaryrefslogtreecommitdiff
path: root/boot/semantic.cc
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-06 10:44:15 +0200
committerEugen Wissner <belka@caraus.de>2026-07-07 00:47:59 +0200
commit470bfba45661d19558c0bf43b7819696a925ecb4 (patch)
tree44eef131a3edca1cc5489fa45851a5d5685ec530 /boot/semantic.cc
parent8ea930783d15c04bbe9a027eaf19ca10e2cd87c0 (diff)
downloadelna-470bfba45661d19558c0bf43b7819696a925ecb4.tar.gz
Fix compiler crashing on syntax errors
after error reporting.
Diffstat (limited to 'boot/semantic.cc')
-rw-r--r--boot/semantic.cc53
1 files changed, 25 insertions, 28 deletions
diff --git a/boot/semantic.cc b/boot/semantic.cc
index 300c91d..29ef3c1 100644
--- a/boot/semantic.cc
+++ b/boot/semantic.cc
@@ -22,8 +22,8 @@ along with GCC; see the file COPYING3. If not see
namespace elna::boot
{
- undeclared_error::undeclared_error(const std::string& identifier, const char *path, const struct position position)
- : error(path, position), identifier(identifier)
+ undeclared_error::undeclared_error(const std::string& identifier, const struct position position)
+ : error(position), identifier(identifier)
{
}
@@ -32,9 +32,8 @@ namespace elna::boot
return "Type '" + identifier + "' not declared";
}
- already_declared_error::already_declared_error(const std::string& identifier,
- const char *path, const struct position position)
- : error(path, position), identifier(identifier)
+ already_declared_error::already_declared_error(const std::string& identifier, const struct position position)
+ : error(position), identifier(identifier)
{
}
@@ -43,9 +42,8 @@ namespace elna::boot
return "Symbol '" + identifier + "' has been already declared";
}
- field_duplication_error::field_duplication_error(const std::string& field_name,
- const char *path, const struct position position)
- : error(path, position), field_name(field_name)
+ field_duplication_error::field_duplication_error(const std::string& field_name, const struct position position)
+ : error(position), field_name(field_name)
{
}
@@ -55,8 +53,8 @@ namespace elna::boot
}
cyclic_declaration_error::cyclic_declaration_error(const std::vector<std::string>& cycle,
- const char *path, const struct position position)
- : error(path, position), cycle(cycle)
+ const struct position position)
+ : error(position), cycle(cycle)
{
}
@@ -73,8 +71,8 @@ namespace elna::boot
return message;
}
- return_error::return_error(const std::string& identifier, const char *path, const struct position position)
- : error(path, position), identifier(identifier)
+ return_error::return_error(const std::string& identifier, const struct position position)
+ : error(position), identifier(identifier)
{
}
@@ -83,8 +81,8 @@ namespace elna::boot
return "Procedure '" + identifier + "' is expected to return, but does not have a return statement";
}
- variable_initializer_error::variable_initializer_error(const char *path, const struct position position)
- : error(path, position)
+ variable_initializer_error::variable_initializer_error(const struct position position)
+ : error(position)
{
}
@@ -93,8 +91,8 @@ namespace elna::boot
return "Only one variable can be initialized";
}
- type_analysis_visitor::type_analysis_visitor(const char *path, symbol_bag bag)
- : error_container(path), bag(bag)
+ type_analysis_visitor::type_analysis_visitor(symbol_bag bag)
+ : error_container(), bag(bag)
{
}
@@ -113,7 +111,7 @@ namespace elna::boot
}
if (!this->returns)
{
- add_error<return_error>(definition->identifier.name, this->input_file, definition->position());
+ add_error<return_error>(definition->identifier.name, definition->position());
}
}
}
@@ -187,12 +185,12 @@ namespace elna::boot
if (!check_unresolved_symbol(unresolved_type, alias_path))
{
- add_error<cyclic_declaration_error>(alias_path, this->input_file, definition->position());
+ add_error<cyclic_declaration_error>(alias_path, definition->position());
}
}
- name_analysis_visitor::name_analysis_visitor(const char *path, symbol_bag bag)
- : error_container(path), bag(bag)
+ name_analysis_visitor::name_analysis_visitor(symbol_bag bag)
+ : error_container(), bag(bag)
{
}
@@ -280,7 +278,7 @@ namespace elna::boot
{
if (field_names.find(field.first) != field_names.cend())
{
- add_error<field_duplication_error>(field.first, this->input_file, field.second->position());
+ add_error<field_duplication_error>(field.first, field.second->position());
}
else
{
@@ -332,7 +330,7 @@ namespace elna::boot
if (!this->bag.enter(name, variable_symbol))
{
- add_error<already_declared_error>(name, this->input_file, position);
+ add_error<already_declared_error>(name, position);
}
return variable_symbol;
}
@@ -567,7 +565,7 @@ namespace elna::boot
}
else
{
- add_error<undeclared_error>(type_expression->name, this->input_file, type_expression->position());
+ add_error<undeclared_error>(type_expression->name, type_expression->position());
this->current_type = type();
}
}
@@ -623,8 +621,8 @@ namespace elna::boot
this->current_literal = literal->value;
}
- declaration_visitor::declaration_visitor(const char *path)
- : error_container(path)
+ declaration_visitor::declaration_visitor()
+ : error_container()
{
}
@@ -663,8 +661,7 @@ namespace elna::boot
if (!this->unresolved.insert({ type_identifier, std::make_shared<alias_type>(type_identifier) }).second)
{
- add_error<already_declared_error>(definition->identifier.name, this->input_file,
- definition->position());
+ add_error<already_declared_error>(definition->identifier.name, definition->position());
}
}
@@ -672,7 +669,7 @@ namespace elna::boot
{
if (declaration->has_initializer() && declaration->identifiers.size() > 1)
{
- add_error<variable_initializer_error>(this->input_file, declaration->position());
+ add_error<variable_initializer_error>(declaration->position());
}
}