From aede794e438d44d152354b02b0fc5670105032ed Mon Sep 17 00:00:00 2001 From: Sam Vervaeck Date: Fri, 2 Jun 2023 16:28:05 +0200 Subject: [PATCH] Keep track of errors in DiagnosticEngine --- include/bolt/DiagnosticEngine.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/bolt/DiagnosticEngine.hpp b/include/bolt/DiagnosticEngine.hpp index 449f1ca17..7276f91a2 100644 --- a/include/bolt/DiagnosticEngine.hpp +++ b/include/bolt/DiagnosticEngine.hpp @@ -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 void add(Ts&&... Args) { + HasError = true; addDiagnostic(new D { std::forward(Args)... }); }