summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-04 17:49:54 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-04 22:07:36 +0100
commitc81001f920bb4d2dd33631c677ef464abf6047dd (patch)
tree7a6b552e9616c6cb8575aef20837d37707fbace9 /Userland/Libraries
parentc9d8aa613920cfc659477ac8f519059a79df9a9b (diff)
downloadserenity-c81001f920bb4d2dd33631c677ef464abf6047dd.zip
LibJS: Add Value::operator==()
This is needed for MarkedValueList::contains_slow() to work.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h
index 18929724ef..7013027c94 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.h
+++ b/Userland/Libraries/LibJS/Runtime/Value.h
@@ -301,6 +301,8 @@ public:
String typeof() const;
+ bool operator==(Value const&) const;
+
private:
Type m_type { Type::Empty };
@@ -383,6 +385,8 @@ bool same_value_zero(Value lhs, Value rhs);
bool same_value_non_numeric(Value lhs, Value rhs);
TriState abstract_relation(GlobalObject&, bool left_first, Value lhs, Value rhs);
+inline bool Value::operator==(Value const& value) const { return same_value(*this, value); }
+
struct ValueTraits : public Traits<Value> {
static unsigned hash(Value value)
{