mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibJS: Convert to_double() to ThrowCompletionOr
This commit is contained in:
parent
51c33b3b35
commit
1639ed7e0a
Notes:
sideshowbarker
2024-07-18 02:17:22 +09:00
Author: https://github.com/IdanHo
Commit: 1639ed7e0a
Pull-request: https://github.com/SerenityOS/serenity/pull/10504
Reviewed-by: https://github.com/linusg
10 changed files with 23 additions and 40 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue