Keep track of errors in DiagnosticEngine
This commit is contained in:
parent
693301bac6
commit
aede794e43
1 changed files with 8 additions and 0 deletions
|
@ -17,12 +17,20 @@ namespace bolt {
|
||||||
class Node;
|
class Node;
|
||||||
|
|
||||||
class DiagnosticEngine {
|
class DiagnosticEngine {
|
||||||
|
|
||||||
|
bool HasError = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
inline bool hasError() const noexcept {
|
||||||
|
return HasError;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void addDiagnostic(Diagnostic* Diagnostic) = 0;
|
virtual void addDiagnostic(Diagnostic* Diagnostic) = 0;
|
||||||
|
|
||||||
template<typename D, typename ...Ts>
|
template<typename D, typename ...Ts>
|
||||||
void add(Ts&&... Args) {
|
void add(Ts&&... Args) {
|
||||||
|
HasError = true;
|
||||||
addDiagnostic(new D { std::forward<Ts>(Args)... });
|
addDiagnostic(new D { std::forward<Ts>(Args)... });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue