1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:17:35 +00:00

LibJS: Make the default constructed reference invalid

Since we have the to_reference method on every expression class we must
somehow communicate it did not actually return a reference.
This (ab)uses the fact that property name is only invalid with the
default constructor and already has is_valid().
This commit is contained in:
davidot 2021-09-27 22:28:56 +02:00 committed by Linus Groh
parent ce3f29a135
commit 7081fb4eb0
2 changed files with 8 additions and 1 deletions

View file

@ -109,6 +109,8 @@ public:
String to_string() const;
bool is_valid_reference() const { return m_name.is_valid(); }
private:
void throw_reference_error(GlobalObject&) const;