This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#include <utility>
|
||||
|
||||
#include <memory> // For std::unique_ptr
|
||||
#include "DiagnosticsHolder.hpp"
|
||||
#include "ErrorMessages-EN-US.cpp"
|
||||
@@ -10,23 +8,23 @@ vector<Diagnostic> DiagnosticsHolder::GetDiagnostics() {
|
||||
}
|
||||
|
||||
void DiagnosticsHolder::Log(DiagnosticSeverity severity, DiagnosticCode code, unsigned int start, unsigned int length,
|
||||
std::vector<string> arguments) {
|
||||
const std::vector<string>& arguments) {
|
||||
_diagnostics.emplace_back(severity, code, start, length, arguments);
|
||||
if (severity >= DiagnosticSeverity::Error){
|
||||
_hasErrors = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DiagnosticsHolder::LogError(DiagnosticCode code, unsigned int start, unsigned int length, std::vector<string> arguments) {
|
||||
Log(DiagnosticSeverity::Error, code, start, length, std::move(arguments));
|
||||
void DiagnosticsHolder::LogError(DiagnosticCode code, unsigned int start, unsigned int length, const std::vector<string>& arguments) {
|
||||
Log(DiagnosticSeverity::Error, code, start, length, arguments);
|
||||
}
|
||||
|
||||
void DiagnosticsHolder::LogWarning(DiagnosticCode code, unsigned int start, unsigned int length, std::vector<string> arguments) {
|
||||
Log(DiagnosticSeverity::Warning, code, start, length, std::move(arguments));
|
||||
void DiagnosticsHolder::LogWarning(DiagnosticCode code, unsigned int start, unsigned int length, const std::vector<string>& arguments) {
|
||||
Log(DiagnosticSeverity::Warning, code, start, length, arguments);
|
||||
}
|
||||
|
||||
void DiagnosticsHolder::LogInfo(DiagnosticCode code, unsigned int start, unsigned int length, std::vector<string> arguments) {
|
||||
Log(DiagnosticSeverity::Info, code, start, length, std::move(arguments));
|
||||
void DiagnosticsHolder::LogInfo(DiagnosticCode code, unsigned int start, unsigned int length, const std::vector<string>& arguments) {
|
||||
Log(DiagnosticSeverity::Info, code, start, length, arguments);
|
||||
}
|
||||
|
||||
bool DiagnosticsHolder::HasErrors() {
|
||||
@@ -91,10 +89,10 @@ void findAndReplaceAll(std::string & data, const std::string& toSearch, const st
|
||||
}
|
||||
}
|
||||
|
||||
const string PrettyDiagnostic ( const char * format, vector<string> arguments)
|
||||
string PrettyDiagnostic ( const char * format, vector<string> arguments)
|
||||
{
|
||||
string result = string(format);
|
||||
for (int i = 0; i < arguments.size(); i++){
|
||||
for (size_t i = 0; i < arguments.size(); i++){
|
||||
auto keyToReplace = "{" + to_string(i) + "}";
|
||||
auto argument = arguments[i];
|
||||
findAndReplaceAll(result, keyToReplace, argument);
|
||||
|
||||
Reference in New Issue
Block a user