Keep track of errors in DiagnosticEngine

This commit is contained in:
Sam Vervaeck 2023-06-02 16:28:05 +02:00
parent 693301bac6
commit aede794e43
Signed by: samvv
SSH key fingerprint: SHA256:dIg0ywU1OP+ZYifrYxy8c5esO72cIKB+4/9wkZj1VaY

View file

@ -17,12 +17,20 @@ namespace bolt {
class Node;
class DiagnosticEngine {
bool HasError = false;
public:
inline bool hasError() const noexcept {
return HasError;
}
virtual void addDiagnostic(Diagnostic* Diagnostic) = 0;
template<typename D, typename ...Ts>
void add(Ts&&... Args) {
HasError = true;
addDiagnostic(new D { std::forward<Ts>(Args)... });
}