2020-08-08 07:31:55 -07:00
|
|
|
#include "Report.h"
|
|
|
|
|
|
2020-08-14 23:01:19 -07:00
|
|
|
#include "clib/logfacility.h"
|
2021-02-25 16:53:22 +01:00
|
|
|
#include "bscript/compiler/file/SourceLocation.h"
|
2020-08-08 07:31:55 -07:00
|
|
|
|
2020-08-10 03:20:29 -07:00
|
|
|
namespace Pol::Bscript::Compiler
|
2020-08-08 07:31:55 -07:00
|
|
|
{
|
|
|
|
|
Report::Report( bool display_warnings )
|
|
|
|
|
: display_warnings( display_warnings ), errors( 0 ), warnings( 0 )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Report::report_error( const SourceLocation& source_location, const char* msg )
|
|
|
|
|
{
|
|
|
|
|
++errors;
|
2020-09-05 01:19:12 -07:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ERROR_PRINT << source_location << ": error: " << msg;
|
|
|
|
|
} catch (...)
|
|
|
|
|
{
|
|
|
|
|
}
|
2020-08-08 07:31:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Report::report_warning( const SourceLocation& source_location, const char* msg )
|
|
|
|
|
{
|
|
|
|
|
++warnings;
|
2020-09-05 01:19:12 -07:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ERROR_PRINT << source_location << ": warning: " << msg;
|
|
|
|
|
} catch (...)
|
|
|
|
|
{
|
|
|
|
|
}
|
2020-08-08 07:31:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Report::error_count() const
|
|
|
|
|
{
|
|
|
|
|
return errors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned Report::warning_count() const
|
|
|
|
|
{
|
|
|
|
|
return warnings;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 03:20:29 -07:00
|
|
|
} // namespace Pol::Bscript::Compiler
|