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 /Meta | |
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 'Meta')
-rw-r--r-- | Meta/Lagom/Fuzzers/FuzzJs.cpp | 2 | ||||
-rw-r--r-- | Meta/Lagom/Fuzzers/FuzzilliJs.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Meta/Lagom/Fuzzers/FuzzJs.cpp b/Meta/Lagom/Fuzzers/FuzzJs.cpp index a0909c1ac3..19dcb8a404 100644 --- a/Meta/Lagom/Fuzzers/FuzzJs.cpp +++ b/Meta/Lagom/Fuzzers/FuzzJs.cpp @@ -21,7 +21,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) if (!parser.has_errors()) { auto vm = JS::VM::create(); auto interpreter = JS::Interpreter::create<JS::GlobalObject>(*vm); - interpreter->run(interpreter->global_object(), *program); + (void)interpreter->run(interpreter->global_object(), *program); } return 0; } diff --git a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp index 4e488b825b..530e570601 100644 --- a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp +++ b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp @@ -213,8 +213,8 @@ int main(int, char**) if (parser.has_errors()) { result = 1; } else { - interpreter->run(interpreter->global_object(), *program); - if (interpreter->exception()) { + auto completion = interpreter->run(interpreter->global_object(), *program); + if (completion.is_error()) { result = 1; vm->clear_exception(); } |