diff options
author | Linus Groh <mail@linusgroh.de> | 2022-01-08 21:28:27 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-08 23:43:03 +0100 |
commit | eb60d16549eb9415cdbd729afb1f318e8f010dbd (patch) | |
tree | a2cbf9f97cc5b825b0b633b7a6d1d9e9fd7d637a /Userland/Libraries/LibJS/Interpreter.h | |
parent | f73afbb5ae533706d2445799473de72e7ecfd224 (diff) | |
download | serenity-eb60d16549eb9415cdbd729afb1f318e8f010dbd.zip |
LibJS: Convert Interpreter::run() to ThrowCompletionOr<Value>
Instead of making it a void function, checking for an exception, and
then receiving the relevant result via VM::last_value(), we can
consolidate all of this by using completions.
This allows us to remove more uses of VM::exception(), and all uses of
VM::last_value().
Diffstat (limited to 'Userland/Libraries/LibJS/Interpreter.h')
-rw-r--r-- | Userland/Libraries/LibJS/Interpreter.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Interpreter.h b/Userland/Libraries/LibJS/Interpreter.h index 1f46a531a8..868cc423c1 100644 --- a/Userland/Libraries/LibJS/Interpreter.h +++ b/Userland/Libraries/LibJS/Interpreter.h @@ -15,6 +15,7 @@ #include <LibJS/Forward.h> #include <LibJS/Heap/DeferGC.h> #include <LibJS/Heap/Heap.h> +#include <LibJS/Runtime/Completion.h> #include <LibJS/Runtime/DeclarativeEnvironment.h> #include <LibJS/Runtime/ErrorTypes.h> #include <LibJS/Runtime/Exception.h> @@ -52,7 +53,7 @@ public: ~Interpreter(); - void run(GlobalObject&, const Program&); + ThrowCompletionOr<Value> run(GlobalObject&, const Program&); GlobalObject& global_object(); const GlobalObject& global_object() const; |