summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Script.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-14 20:56:57 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-14 21:41:51 +0200
commit10c489713d828e002e1577a4fcdfafc37741afa0 (patch)
treef7dae4fdc4051a189b77156f907e81ae40dbe9c7 /Userland/Libraries/LibJS/Script.h
parent5fa02b8a9e41f680a7996fee3f5f5f708d0ec638 (diff)
downloadserenity-10c489713d828e002e1577a4fcdfafc37741afa0.zip
LibJS+LibWeb: Let JS::Script::parse() return a list of errors (on error)
These are really supposed to be a list of SyntaxError objects, but for now we simply return all the Parser::Error objects we got from Parser.
Diffstat (limited to 'Userland/Libraries/LibJS/Script.h')
-rw-r--r--Userland/Libraries/LibJS/Script.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Script.h b/Userland/Libraries/LibJS/Script.h
index 037dea4629..c58ddf956f 100644
--- a/Userland/Libraries/LibJS/Script.h
+++ b/Userland/Libraries/LibJS/Script.h
@@ -10,6 +10,7 @@
#include <AK/RefCounted.h>
#include <LibJS/AST.h>
#include <LibJS/Heap/Handle.h>
+#include <LibJS/Parser.h>
#include <LibJS/Runtime/Realm.h>
namespace JS {
@@ -18,7 +19,7 @@ namespace JS {
class Script : public RefCounted<Script> {
public:
~Script();
- static NonnullRefPtr<Script> parse(StringView source_text, Realm&, StringView filename = {});
+ static Result<NonnullRefPtr<Script>, Vector<Parser::Error>> parse(StringView source_text, Realm&, StringView filename = {});
Realm& realm() { return *m_realm.cell(); }
Program const& parse_node() const { return *m_parse_node; }