1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

LibJS: Implement bytecode generation for all ObjectExpression properties

This commit is contained in:
Ali Mohammad Pur 2022-03-31 00:59:58 +04:30 committed by Andreas Kling
parent 698fb3957a
commit 007ffcd763
3 changed files with 94 additions and 17 deletions

View file

@ -410,12 +410,21 @@ private:
IdentifierTableIndex m_property;
};
enum class PropertyKind {
Getter,
Setter,
KeyValue,
Spread,
ProtoSetter,
};
class PutById final : public Instruction {
public:
explicit PutById(Register base, IdentifierTableIndex property)
explicit PutById(Register base, IdentifierTableIndex property, PropertyKind kind = PropertyKind::KeyValue)
: Instruction(Type::PutById)
, m_base(base)
, m_property(property)
, m_kind(kind)
{
}
@ -426,6 +435,7 @@ public:
private:
Register m_base;
IdentifierTableIndex m_property;
PropertyKind m_kind;
};
class DeleteById final : public Instruction {
@ -462,10 +472,11 @@ private:
class PutByValue final : public Instruction {
public:
PutByValue(Register base, Register property)
PutByValue(Register base, Register property, PropertyKind kind = PropertyKind::KeyValue)
: Instruction(Type::PutByValue)
, m_base(base)
, m_property(property)
, m_kind(kind)
{
}
@ -476,6 +487,7 @@ public:
private:
Register m_base;
Register m_property;
PropertyKind m_kind;
};
class DeleteByValue final : public Instruction {