* @file
*
* This file implements diagnostic suppressor class for semantic check.
*/
#include "DiagSuppressor.h"
using namespace Cangjie;
using namespace std;
std::vector<Diagnostic> DiagSuppressor::GetSuppressedDiag()
{
return diag.ConsumeStoredDiags();
}
void DiagSuppressor::ReportDiag()
{
auto diags = GetSuppressedDiag();
diag.EnableDiagnose(originDiagVec);
for (auto& d : diags) {
diag.Diagnose(d);
}
originDiagVec = diag.DisableDiagnose();
}
bool DiagSuppressor::HasError() const
{
return Utils::In(diag.GetStoredDiags(),
[](const Diagnostic& d) { return d.diagSeverity == DiagSeverity::DS_ERROR; });
}