Add ErrorReporter::fatalTypeError() with secondary location

This commit is contained in:
Mathias Baumann 2019-03-04 14:30:08 +01:00
parent b2262d67f0
commit 8d747ad47b
2 changed files with 22 additions and 0 deletions

View File

@ -118,6 +118,12 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type)
return false;
}
void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description)
{
error(_type, _location, _secondaryLocation, _description);
BOOST_THROW_EXCEPTION(FatalError());
}
void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, string const& _description)
{
error(_type, _location, _description);
@ -207,6 +213,15 @@ void ErrorReporter::typeError(SourceLocation const& _location, string const& _de
);
}
void ErrorReporter::fatalTypeError(SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description)
{
fatalError(
Error::Type::TypeError,
_location,
_secondaryLocation,
_description
);
}
void ErrorReporter::fatalTypeError(SourceLocation const& _location, string const& _description)
{

View File

@ -104,6 +104,7 @@ public:
}
void fatalTypeError(SourceLocation const& _location, std::string const& _description);
void fatalTypeError(SourceLocation const& _location, SecondarySourceLocation const& _secondLocation, std::string const& _description);
void docstringParsingError(std::string const& _description);
@ -123,6 +124,12 @@ private:
SecondarySourceLocation const& _secondaryLocation,
std::string const& _description = std::string());
void fatalError(
Error::Type _type,
SourceLocation const& _location,
SecondarySourceLocation const& _secondaryLocation,
std::string const& _description = std::string());
void fatalError(Error::Type _type,
SourceLocation const& _location = SourceLocation(),
std::string const& _description = std::string());