mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibJS: Rename strict_eq() to is_strictly_equal()
This got turned into a proper AO with a new name recently.
See: 19d7ca4
This commit is contained in:
parent
bc5a04f798
commit
c7ff89891c
6 changed files with 12 additions and 12 deletions
|
@ -656,9 +656,9 @@ Value BinaryExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
||||||
case BinaryOp::Exponentiation:
|
case BinaryOp::Exponentiation:
|
||||||
return exp(global_object, lhs_result, rhs_result);
|
return exp(global_object, lhs_result, rhs_result);
|
||||||
case BinaryOp::TypedEquals:
|
case BinaryOp::TypedEquals:
|
||||||
return Value(strict_eq(lhs_result, rhs_result));
|
return Value(is_strictly_equal(lhs_result, rhs_result));
|
||||||
case BinaryOp::TypedInequals:
|
case BinaryOp::TypedInequals:
|
||||||
return Value(!strict_eq(lhs_result, rhs_result));
|
return Value(!is_strictly_equal(lhs_result, rhs_result));
|
||||||
case BinaryOp::AbstractEquals:
|
case BinaryOp::AbstractEquals:
|
||||||
return Value(abstract_eq(global_object, lhs_result, rhs_result));
|
return Value(abstract_eq(global_object, lhs_result, rhs_result));
|
||||||
case BinaryOp::AbstractInequals:
|
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);
|
auto test_result = switch_case.test()->execute(interpreter, global_object);
|
||||||
if (interpreter.exception())
|
if (interpreter.exception())
|
||||||
return {};
|
return {};
|
||||||
if (!strict_eq(discriminant_result, test_result))
|
if (!is_strictly_equal(discriminant_result, test_result))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
falling_through = true;
|
falling_through = true;
|
||||||
|
|
|
@ -67,12 +67,12 @@ static Value abstract_equals(GlobalObject& global_object, Value src1, Value src2
|
||||||
|
|
||||||
static Value typed_inequals(GlobalObject&, 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)
|
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) \
|
#define JS_DEFINE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
|
||||||
|
|
|
@ -806,7 +806,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
// ii. Let same be IsStrictlyEqual(searchElement, elementK).
|
// 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).
|
// iii. If same is true, return 𝔽(k).
|
||||||
if (same)
|
if (same)
|
||||||
|
@ -1302,7 +1302,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
// ii. Let same be IsStrictlyEqual(searchElement, elementK).
|
// 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).
|
// iii. If same is true, return 𝔽(k).
|
||||||
if (same)
|
if (same)
|
||||||
|
|
|
@ -451,7 +451,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::index_of)
|
||||||
if (k_present) {
|
if (k_present) {
|
||||||
auto element_k = typed_array->get(k);
|
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);
|
return Value(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::last_index_of)
|
||||||
if (k_present) {
|
if (k_present) {
|
||||||
auto element_k = typed_array->get(k);
|
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);
|
return Value(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// 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))
|
if (!same_type_for_equality(lhs, rhs))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1430,7 +1430,7 @@ bool abstract_eq(GlobalObject& global_object, Value lhs, Value rhs)
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
if (same_type_for_equality(lhs, rhs))
|
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())
|
if (lhs.is_nullish() && rhs.is_nullish())
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -371,7 +371,7 @@ Value instance_of(GlobalObject&, Value lhs, Value rhs);
|
||||||
Value ordinary_has_instance(GlobalObject&, Value lhs, Value rhs);
|
Value ordinary_has_instance(GlobalObject&, Value lhs, Value rhs);
|
||||||
|
|
||||||
bool abstract_eq(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(Value lhs, Value rhs);
|
||||||
bool same_value_zero(Value lhs, Value rhs);
|
bool same_value_zero(Value lhs, Value rhs);
|
||||||
bool same_value_non_numeric(Value lhs, Value rhs);
|
bool same_value_non_numeric(Value lhs, Value rhs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue