From 4eede5282c64a83372dd1d69d28d3c794c8726aa Mon Sep 17 00:00:00 2001 From: Dan Klishch Date: Fri, 18 Aug 2023 15:52:24 -0400 Subject: [PATCH] JSSpecCompiler: Allow storing error text in ErrorNode This will be the main way to communicate errors from compilation passes. --- Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h | 7 ++++++- .../CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h index 2ae3026af5..30a6500dc0 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/AST.h @@ -57,7 +57,12 @@ protected: class ErrorNode : public Node { public: - ErrorNode() { } + ErrorNode(StringView error = ""sv) + : m_error(error) + { + } + + StringView m_error; protected: void dump_tree(StringBuilder& builder) override; diff --git a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp index e80ba6d8a8..a07fe99840 100644 --- a/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/JSSpecCompiler/AST/ASTPrinting.cpp @@ -31,7 +31,7 @@ void Node::dump_node(StringBuilder& builder, AK::CheckedFormatString