1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:18:14 +00:00

LibJS: Add spreading in object literals

Supports spreading strings, arrays, and other objects within object
literals.
This commit is contained in:
mattco98 2020-04-27 21:52:47 -07:00 committed by Andreas Kling
parent 3cc31ff3f3
commit 104969a9f5
4 changed files with 116 additions and 0 deletions

View file

@ -703,6 +703,9 @@ public:
const Expression& key() const { return m_key; }
const Expression& value() const { return m_value; }
bool is_spread() const { return m_is_spread; }
void set_is_spread() { m_is_spread = true; }
virtual void dump(int indent) const override;
virtual Value execute(Interpreter&) const override;
@ -711,6 +714,7 @@ private:
NonnullRefPtr<Expression> m_key;
NonnullRefPtr<Expression> m_value;
bool m_is_spread { false };
};
class ObjectExpression : public Expression {