1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:27:43 +00:00

JSSpecCompiler: Start converting crashes to error messages

I got fed up with looking at error messages that tell me "VERIFICATION
FAILED: !is_error()". So this commit introduces DiagnosticEngine class
whose purpose is to accumulate and print more user-friendly errors.
This commit is contained in:
Dan Klishch 2024-01-18 21:09:53 -05:00 committed by Andrew Kaster
parent 3aec6952a2
commit 0806ccaeec
8 changed files with 262 additions and 4 deletions

View file

@ -11,6 +11,7 @@
#include <AK/RefPtr.h>
#include <AK/StringView.h>
#include "DiagnosticEngine.h"
#include "Forward.h"
namespace JSSpecCompiler {
@ -26,10 +27,12 @@ public:
FunctionDeclarationRef find_declaration_by_name(StringView name) const;
StringView filename() const { return m_filename; }
DiagnosticEngine& diag() { return m_diagnostic_engine; }
Vector<FunctionDefinitionRef> functions_to_compile() const { return m_functions_to_compile; }
private:
StringView m_filename;
DiagnosticEngine m_diagnostic_engine;
Vector<FunctionDefinitionRef> m_functions_to_compile;
Vector<NonnullRefPtr<FunctionDeclaration>> m_declarations_owner;
HashMap<StringView, FunctionDeclarationRef> m_function_index;