Forráskód Böngészése

LibJS: Rename abstract_relation() to is_less_than()

This got turned into a proper AO with a new name recently.

See: https://github.com/tc39/ecma262/commit/587adc0
Linus Groh 3 éve
szülő
commit
facbe32fcd

+ 3 - 3
Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp

@@ -1146,11 +1146,11 @@ static void array_merge_sort(VM& vm, GlobalObject& global_object, FunctionObject
             auto x_string_value = Value(x_string);
             auto x_string_value = Value(x_string);
             auto y_string_value = Value(y_string);
             auto y_string_value = Value(y_string);
 
 
-            // Because they are called with primitive strings, these abstract_relation calls
+            // Because they are called with primitive strings, these is_less_than calls
             // should never result in a VM exception.
             // should never result in a VM exception.
-            auto x_lt_y_relation = abstract_relation(global_object, true, x_string_value, y_string_value);
+            auto x_lt_y_relation = is_less_than(global_object, true, x_string_value, y_string_value);
             VERIFY(x_lt_y_relation != TriState::Unknown);
             VERIFY(x_lt_y_relation != TriState::Unknown);
-            auto y_lt_x_relation = abstract_relation(global_object, true, y_string_value, x_string_value);
+            auto y_lt_x_relation = is_less_than(global_object, true, y_string_value, x_string_value);
             VERIFY(y_lt_x_relation != TriState::Unknown);
             VERIFY(y_lt_x_relation != TriState::Unknown);
 
 
             if (x_lt_y_relation == TriState::True) {
             if (x_lt_y_relation == TriState::True) {

+ 5 - 5
Userland/Libraries/LibJS/Runtime/Value.cpp

@@ -843,7 +843,7 @@ ThrowCompletionOr<FunctionObject*> Value::get_method(GlobalObject& global_object
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 Value greater_than(GlobalObject& global_object, Value lhs, Value rhs)
 Value greater_than(GlobalObject& global_object, Value lhs, Value rhs)
 {
 {
-    TriState relation = abstract_relation(global_object, false, lhs, rhs);
+    TriState relation = is_less_than(global_object, false, lhs, rhs);
     if (relation == TriState::Unknown)
     if (relation == TriState::Unknown)
         return Value(false);
         return Value(false);
     return Value(relation == TriState::True);
     return Value(relation == TriState::True);
@@ -852,7 +852,7 @@ Value greater_than(GlobalObject& global_object, Value lhs, Value rhs)
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 Value greater_than_equals(GlobalObject& global_object, Value lhs, Value rhs)
 Value greater_than_equals(GlobalObject& global_object, Value lhs, Value rhs)
 {
 {
-    TriState relation = abstract_relation(global_object, true, lhs, rhs);
+    TriState relation = is_less_than(global_object, true, lhs, rhs);
     if (relation == TriState::Unknown || relation == TriState::True)
     if (relation == TriState::Unknown || relation == TriState::True)
         return Value(false);
         return Value(false);
     return Value(true);
     return Value(true);
@@ -861,7 +861,7 @@ Value greater_than_equals(GlobalObject& global_object, Value lhs, Value rhs)
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 Value less_than(GlobalObject& global_object, Value lhs, Value rhs)
 Value less_than(GlobalObject& global_object, Value lhs, Value rhs)
 {
 {
-    TriState relation = abstract_relation(global_object, true, lhs, rhs);
+    TriState relation = is_less_than(global_object, true, lhs, rhs);
     if (relation == TriState::Unknown)
     if (relation == TriState::Unknown)
         return Value(false);
         return Value(false);
     return Value(relation == TriState::True);
     return Value(relation == TriState::True);
@@ -870,7 +870,7 @@ Value less_than(GlobalObject& global_object, Value lhs, Value rhs)
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 // 13.10 Relational Operators, https://tc39.es/ecma262/#sec-relational-operators
 Value less_than_equals(GlobalObject& global_object, Value lhs, Value rhs)
 Value less_than_equals(GlobalObject& global_object, Value lhs, Value rhs)
 {
 {
-    TriState relation = abstract_relation(global_object, false, lhs, rhs);
+    TriState relation = is_less_than(global_object, false, lhs, rhs);
     if (relation == TriState::Unknown || relation == TriState::True)
     if (relation == TriState::Unknown || relation == TriState::True)
         return Value(false);
         return Value(false);
     return Value(true);
     return Value(true);
@@ -1492,7 +1492,7 @@ bool is_loosely_equal(GlobalObject& global_object, Value lhs, Value rhs)
 }
 }
 
 
 // 7.2.13 IsLessThan ( x, y, LeftFirst ), https://tc39.es/ecma262/#sec-islessthan
 // 7.2.13 IsLessThan ( x, y, LeftFirst ), https://tc39.es/ecma262/#sec-islessthan
-TriState abstract_relation(GlobalObject& global_object, bool left_first, Value lhs, Value rhs)
+TriState is_less_than(GlobalObject& global_object, bool left_first, Value lhs, Value rhs)
 {
 {
     Value x_primitive;
     Value x_primitive;
     Value y_primitive;
     Value y_primitive;

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Value.h

@@ -375,7 +375,7 @@ 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);
-TriState abstract_relation(GlobalObject&, bool left_first, Value lhs, Value rhs);
+TriState is_less_than(GlobalObject&, bool left_first, Value lhs, Value rhs);
 
 
 inline bool Value::operator==(Value const& value) const { return same_value(*this, value); }
 inline bool Value::operator==(Value const& value) const { return same_value(*this, value); }