summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-09-23 23:43:28 +0200
committerLinus Groh <mail@linusgroh.de>2021-09-24 09:13:57 +0200
commitc7ff89891c5df83862f430e2193646c5434f6f91 (patch)
treeb01bc4abd8a33d3e5a8d03c99e67a72ffe07debb /Userland/Libraries
parentbc5a04f7983eea70731fb81497ee115dfa7736ad (diff)
downloadserenity-c7ff89891c5df83862f430e2193646c5434f6f91.zip
LibJS: Rename strict_eq() to is_strictly_equal()
This got turned into a proper AO with a new name recently. See: https://github.com/tc39/ecma262/commit/19d7ca4
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/AST.cpp6
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Op.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.cpp4
-rw-r--r--Userland/Libraries/LibJS/Runtime/Value.h2
6 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp
index 70a6a9c59b..4de2b80b82 100644
--- a/Userland/Libraries/LibJS/AST.cpp
+++ b/Userland/Libraries/LibJS/AST.cpp
@@ -656,9 +656,9 @@ Value BinaryExpression::execute(Interpreter& interpreter, GlobalObject& global_o
case BinaryOp::Exponentiation:
return exp(global_object, lhs_result, rhs_result);
case BinaryOp::TypedEquals:
- return Value(strict_eq(lhs_result, rhs_result));
+ return Value(is_strictly_equal(lhs_result, rhs_result));
case BinaryOp::TypedInequals:
- return Value(!strict_eq(lhs_result, rhs_result));
+ return Value(!is_strictly_equal(lhs_result, rhs_result));
case BinaryOp::AbstractEquals:
return Value(abstract_eq(global_object, lhs_result, rhs_result));
case BinaryOp::AbstractInequals:
@@ -2423,7 +2423,7 @@ Value SwitchStatement::execute(Interpreter& interpreter, GlobalObject& global_ob
auto test_result = switch_case.test()->execute(interpreter, global_object);
if (interpreter.exception())
return {};
- if (!strict_eq(discriminant_result, test_result))
+ if (!is_strictly_equal(discriminant_result, test_result))
continue;
}
falling_through = true;
diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp
index fd25bb3ab8..179bdd3f12 100644
--- a/Userland/Libraries/LibJS/Bytecode/Op.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp
@@ -67,12 +67,12 @@ static Value abstract_equals(GlobalObject& global_object, Value src1, Value src2
static Value typed_inequals(GlobalObject&, Value src1, Value src2)
{
- return Value(!strict_eq(src1, src2));
+ return Value(!is_strictly_equal(src1, src2));
}
static Value typed_equals(GlobalObject&, Value src1, Value src2)
{
- return Value(strict_eq(src1, src2));
+ return Value(is_strictly_equal(src1, src2));
}
#define JS_DEFINE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
index 6c44484aa3..c49bca97f0 100644
--- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
@@ -806,7 +806,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
return {};
// ii. Let same be IsStrictlyEqual(searchElement, elementK).
- auto same = strict_eq(search_element, element_k);
+ auto same = is_strictly_equal(search_element, element_k);
// iii. If same is true, return 𝔽(k).
if (same)
@@ -1302,7 +1302,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
return {};
// ii. Let same be IsStrictlyEqual(searchElement, elementK).
- auto same = strict_eq(search_element, element_k);
+ auto same = is_strictly_equal(search_element, element_k);
// iii. If same is true, return 𝔽(k).
if (same)
diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp
index 379f76db72..58ec5e847f 100644
--- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp
+++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp
@@ -451,7 +451,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::index_of)
if (k_present) {
auto element_k = typed_array->get(k);
- if (strict_eq(search_element, element_k))
+ if (is_strictly_equal(search_element, element_k))
return Value(k);
}
}
@@ -499,7 +499,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::last_index_of)
if (k_present) {
auto element_k = typed_array->get(k);
- if (strict_eq(search_element, element_k))
+ if (is_strictly_equal(search_element, element_k))
return Value(k);
}
}
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp
index ed2a129951..3ca6aaafc4 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Value.cpp
@@ -1405,7 +1405,7 @@ bool same_value_non_numeric(Value lhs, Value rhs)
}
// 7.2.15 IsStrictlyEqual ( x, y ), https://tc39.es/ecma262/#sec-isstrictlyequal
-bool strict_eq(Value lhs, Value rhs)
+bool is_strictly_equal(Value lhs, Value rhs)
{
if (!same_type_for_equality(lhs, rhs))
return false;
@@ -1430,7 +1430,7 @@ bool abstract_eq(GlobalObject& global_object, Value lhs, Value rhs)
auto& vm = global_object.vm();
if (same_type_for_equality(lhs, rhs))
- return strict_eq(lhs, rhs);
+ return is_strictly_equal(lhs, rhs);
if (lhs.is_nullish() && rhs.is_nullish())
return true;
diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h
index 330d7d30e9..c2f8916ff8 100644
--- a/Userland/Libraries/LibJS/Runtime/Value.h
+++ b/Userland/Libraries/LibJS/Runtime/Value.h
@@ -371,7 +371,7 @@ Value instance_of(GlobalObject&, Value lhs, Value rhs);
Value ordinary_has_instance(GlobalObject&, Value lhs, Value rhs);
bool abstract_eq(GlobalObject&, Value lhs, Value rhs);
-bool strict_eq(Value lhs, Value rhs);
+bool is_strictly_equal(Value lhs, Value rhs);
bool same_value(Value lhs, Value rhs);
bool same_value_zero(Value lhs, Value rhs);
bool same_value_non_numeric(Value lhs, Value rhs);