mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibJS: Implement array destructuring for the bytecode interpreter
This commit is contained in:
parent
14fff5df06
commit
7983324639
4 changed files with 267 additions and 50 deletions
|
@ -582,6 +582,7 @@ public:
|
|||
, m_variables(move(variables))
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
|
@ -606,6 +607,54 @@ private:
|
|||
size_t m_index { 0 };
|
||||
};
|
||||
|
||||
class GetIterator final : public Instruction {
|
||||
public:
|
||||
GetIterator()
|
||||
: Instruction(Type::GetIterator)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
class IteratorNext final : public Instruction {
|
||||
public:
|
||||
IteratorNext()
|
||||
: Instruction(Type::IteratorNext)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
class IteratorResultDone final : public Instruction {
|
||||
public:
|
||||
IteratorResultDone()
|
||||
: Instruction(Type::IteratorResultDone)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
class IteratorResultValue final : public Instruction {
|
||||
public:
|
||||
IteratorResultValue()
|
||||
: Instruction(Type::IteratorResultValue)
|
||||
{
|
||||
}
|
||||
|
||||
void execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue