mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
LibJS: Add Reference class to represent a base.property reference
Expression nodes can now be asked to produce a Reference. We then use this to implement the "delete" operator without downcasting the child node to a MemberExpression manually.
This commit is contained in:
parent
3a12a8a348
commit
67b8e6fc5b
5 changed files with 105 additions and 9 deletions
|
@ -140,6 +140,8 @@ private:
|
|||
};
|
||||
|
||||
class Expression : public ASTNode {
|
||||
public:
|
||||
virtual Reference to_reference(Interpreter&) const;
|
||||
};
|
||||
|
||||
class Declaration : public Statement {
|
||||
|
@ -755,6 +757,7 @@ public:
|
|||
|
||||
virtual Value execute(Interpreter&) const override;
|
||||
virtual void dump(int indent) const override;
|
||||
virtual Reference to_reference(Interpreter&) const override;
|
||||
|
||||
bool is_computed() const { return m_computed; }
|
||||
const Expression& object() const { return *m_object; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue