1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:32:06 +00:00

LibJS: Convert to_double() to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-16 22:11:08 +03:00 committed by Linus Groh
parent 51c33b3b35
commit 1639ed7e0a
10 changed files with 23 additions and 40 deletions

View file

@ -59,8 +59,10 @@ Value GeneratorObject::next_impl(VM& vm, GlobalObject& global_object, Optional<V
};
auto generated_continuation = [&](Value value) -> Bytecode::BasicBlock const* {
if (value.is_object())
return reinterpret_cast<Bytecode::BasicBlock const*>(static_cast<u64>(TRY_OR_DISCARD(value.as_object().get("continuation")).to_double(global_object)));
if (value.is_object()) {
auto number_value = TRY_OR_DISCARD(value.as_object().get("continuation"));
return reinterpret_cast<Bytecode::BasicBlock const*>(static_cast<u64>(TRY_OR_DISCARD(number_value.to_double(global_object))));
}
return nullptr;
};