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

LibJS: Parse ArrayExpression and start implementing Array objects

Note that property lookup is not functional yet.
This commit is contained in:
Andreas Kling 2020-03-20 20:29:57 +01:00
parent 0891f860f7
commit a82f64d3d6
9 changed files with 176 additions and 0 deletions

View file

@ -581,6 +581,24 @@ private:
virtual const char* class_name() const override { return "ObjectExpression"; }
};
class ArrayExpression : public Expression {
public:
ArrayExpression(NonnullRefPtrVector<Expression> elements)
: m_elements(move(elements))
{
}
const NonnullRefPtrVector<Expression>& elements() const { return m_elements; }
virtual Value execute(Interpreter&) const override;
virtual void dump(int indent) const override;
private:
virtual const char* class_name() const override { return "ArrayExpression"; }
NonnullRefPtrVector<Expression> m_elements;
};
class MemberExpression final : public Expression {
public:
MemberExpression(NonnullRefPtr<Expression> object, NonnullRefPtr<Expression> property)