LibJS: Prepare yield object before re-routing it through finally

This commit is contained in:
Hendiadyoin1 2024-05-18 17:25:43 +02:00 committed by Andreas Kling
commit 1de475b404
Notes: sideshowbarker 2024-07-16 22:54:10 +09:00
6 changed files with 102 additions and 14 deletions

View file

@ -2214,6 +2214,31 @@ private:
Operand m_value;
};
class PrepareYield final : public Instruction {
public:
explicit PrepareYield(Operand dest, Operand value)
: Instruction(Type::PrepareYield)
, m_dest(dest)
, m_value(value)
{
}
void execute_impl(Bytecode::Interpreter&) const;
ByteString to_byte_string_impl(Bytecode::Executable const&) const;
void visit_operands_impl(Function<void(Operand&)> visitor)
{
visitor(m_dest);
visitor(m_value);
}
Operand destination() const { return m_dest; }
Operand value() const { return m_value; }
private:
Operand m_dest;
Operand m_value;
};
class Await final : public Instruction {
public:
constexpr static bool IsTerminator = true;