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

LibJS+LibTest+js: Convert BC::Interpreter::run to ThrowCompletionOr<>

Note that this is just a shallow API change.
This commit is contained in:
Ali Mohammad Pur 2021-11-11 04:11:56 +03:30 committed by Linus Groh
parent 3b0bf05fa5
commit 070d2eaa51
7 changed files with 19 additions and 11 deletions

View file

@ -102,10 +102,7 @@ ThrowCompletionOr<Value> GeneratorObject::next_impl(VM& vm, GlobalObject& global
bytecode_interpreter->accumulator() = next_argument.value_or(js_undefined());
}
// Temporarily switch to the captured execution context
vm.push_execution_context(m_execution_context, global_object);
m_previous_value = bytecode_interpreter->run(*m_generating_function->bytecode_executable(), next_block);
auto next_result = bytecode_interpreter->run(*m_generating_function->bytecode_executable(), next_block);
m_frame = move(*bytecode_interpreter->pop_frame());
@ -113,6 +110,8 @@ ThrowCompletionOr<Value> GeneratorObject::next_impl(VM& vm, GlobalObject& global
m_done = TRY(generated_continuation(m_previous_value)) == nullptr;
m_previous_value = TRY(next_result);
result->define_direct_property("value", TRY(generated_value(m_previous_value)), JS::default_attributes);
result->define_direct_property("done", Value(m_done), JS::default_attributes);