summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Reference.h
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-04-02 21:00:37 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-02 22:24:30 +0200
commite875513ff7e34be086d6d8f3c8d77a2f208660f2 (patch)
treec41d778022ffe8ac4824f5dd33c515ab332dcabd /Userland/Libraries/LibJS/Runtime/Reference.h
parentd6cffb82a25973d59312afccf63e958660b30449 (diff)
downloadserenity-e875513ff7e34be086d6d8f3c8d77a2f208660f2.zip
LibJS: Use empty value for Reference unresolvable state, not undefined
This fixes an issue where `undefined.foo = "bar"` would throw a ReferenceError instead of a TypeError as undefined was also used for truly unresolvable references (e.g. `foo() = "bar"`). I also made the various error messages here a bit nicer, just "primitive value" is not very helpful.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Reference.h')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Reference.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Reference.h b/Userland/Libraries/LibJS/Runtime/Reference.h
index d5a8010916..ff94bd0359 100644
--- a/Userland/Libraries/LibJS/Runtime/Reference.h
+++ b/Userland/Libraries/LibJS/Runtime/Reference.h
@@ -64,7 +64,7 @@ public:
const PropertyName& name() const { return m_name; }
bool is_strict() const { return m_strict; }
- bool is_unresolvable() const { return m_base.is_undefined(); }
+ bool is_unresolvable() const { return m_base.is_empty(); }
bool is_property() const
{
return m_base.is_object() || has_primitive_base();
@@ -91,7 +91,7 @@ public:
private:
void throw_reference_error(GlobalObject&);
- Value m_base { js_undefined() };
+ Value m_base;
PropertyName m_name;
bool m_strict { false };
bool m_local_variable { false };