mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28: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
|
@ -60,6 +60,13 @@ public:
|
|||
i32 as_number() const { return m_number; }
|
||||
const FlyString& as_string() const { return m_string; }
|
||||
|
||||
String to_string() const
|
||||
{
|
||||
if (is_string())
|
||||
return as_string();
|
||||
return String::number(as_number());
|
||||
}
|
||||
|
||||
private:
|
||||
Type m_type { Type::Invalid };
|
||||
FlyString m_string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue