1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

LibJS: Implement basic object property assignment

This is pretty naive, we just walk up the prototype chain and call any
NativeProperty setter that we find. If we don't find one, we put/set
the value as an own property of the object itself.
This commit is contained in:
Andreas Kling 2020-03-19 17:39:13 +01:00
parent 7268499c76
commit 1a10470c1d
3 changed files with 32 additions and 9 deletions

View file

@ -49,6 +49,7 @@ public:
virtual Value execute(Interpreter&) const = 0;
virtual void dump(int indent) const;
virtual bool is_identifier() const { return false; }
virtual bool is_member_expression() const { return false; }
protected:
ASTNode() {}
@ -124,8 +125,6 @@ private:
};
class Expression : public ASTNode {
public:
virtual bool is_member_expression() const { return false; }
};
class FunctionNode {
@ -594,6 +593,7 @@ public:
virtual void dump(int indent) const override;
const Expression& object() const { return *m_object; }
const Expression& property() const { return *m_property; }
private:
virtual bool is_member_expression() const override { return true; }