mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-21 15:14:13 +00:00
LibJS: Align codegen AwaitExpressions to YieldExpressions
We use generators in bytecode to approximate async functions, but the code generated by AwaitExpressions did not have the value processing paths that Yield requires, eg the `generator.throw()` path, which is used by AsyncFunctionDriverWrapper to signal Promise rejections.
This commit is contained in:
@@ -836,6 +836,8 @@ ThrowCompletionOr<void> Yield::execute_impl(Bytecode::Interpreter& interpreter)
|
||||
auto object = Object::create(interpreter.realm(), nullptr);
|
||||
object->define_direct_property("result", yielded_value, JS::default_attributes);
|
||||
if (m_continuation_label.has_value())
|
||||
// FIXME: If we get a pointer, which is not accurately representable as a double
|
||||
// will cause this to explode
|
||||
object->define_direct_property("continuation", Value(static_cast<double>(reinterpret_cast<u64>(&m_continuation_label->block()))), JS::default_attributes);
|
||||
else
|
||||
object->define_direct_property("continuation", Value(0), JS::default_attributes);
|
||||
|
||||
Reference in New Issue
Block a user