mark compilerError as noreturn

This commit is contained in:
Thomas Lindner 2023-01-07 09:12:47 +01:00
parent f169088f36
commit 56330a54ad
2 changed files with 1 additions and 5 deletions

View file

@ -17,7 +17,7 @@ class ErrorListener : public antlr4::BaseErrorListener {
bool hasError(); bool hasError();
void compilerError(const std::string &file, size_t line); [[noreturn]] void compilerError(const std::string &file, size_t line);
void duplicateFunction(antlr4::Token *token, const std::string &name); void duplicateFunction(antlr4::Token *token, const std::string &name);
void shadowedVariable(antlr4::Token *token, const std::string &name); void shadowedVariable(antlr4::Token *token, const std::string &name);
void syntaxError(antlr4::Recognizer *recognizer, void syntaxError(antlr4::Recognizer *recognizer,

View file

@ -63,7 +63,6 @@ std::any TypeCheckVisitor::visitType(xlangParser::TypeContext *ctx) {
} }
// unreachable // unreachable
errorlistener.compilerError(__FILE__, __LINE__); errorlistener.compilerError(__FILE__, __LINE__);
return {};
} }
std::any TypeCheckVisitor::visitBlock(xlangParser::BlockContext *ctx) { std::any TypeCheckVisitor::visitBlock(xlangParser::BlockContext *ctx) {
@ -97,7 +96,6 @@ std::any TypeCheckVisitor::visitStatement(xlangParser::StatementContext *ctx) {
} }
// unreachable // unreachable
errorlistener.compilerError(__FILE__, __LINE__); errorlistener.compilerError(__FILE__, __LINE__);
return {};
} }
if (auto condition = ctx->condition()) { if (auto condition = ctx->condition()) {
auto type = std::any_cast<Type>(visitCondition(condition)); auto type = std::any_cast<Type>(visitCondition(condition));
@ -131,7 +129,6 @@ std::any TypeCheckVisitor::visitValue(xlangParser::ValueContext *ctx) {
} }
// unreachable // unreachable
errorlistener.compilerError(__FILE__, __LINE__); errorlistener.compilerError(__FILE__, __LINE__);
return {};
} }
#define CHECKOPERATOR(visitLeft, left, visitRight, right, expected) \ #define CHECKOPERATOR(visitLeft, left, visitRight, right, expected) \
@ -257,7 +254,6 @@ std::any TypeCheckVisitor::visitVariable(xlangParser::VariableContext *ctx) {
} }
// unreachable // unreachable
errorlistener.compilerError(__FILE__, __LINE__); errorlistener.compilerError(__FILE__, __LINE__);
return {};
} }
} // namespace xlang } // namespace xlang