mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
Everywhere: Rename JS::PropertyKey variables from property_{name => key}
PropertyKey used to be called PropertyName, but got renamed. Let's update all the variables of this type as well.
This commit is contained in:
parent
3e6aaa3520
commit
6f20f49b21
25 changed files with 435 additions and 435 deletions
|
@ -44,20 +44,20 @@ void StringObject::visit_edges(Cell::Visitor& visitor)
|
|||
}
|
||||
|
||||
// 10.4.3.5 StringGetOwnProperty ( S, P ), https://tc39.es/ecma262/#sec-stringgetownproperty
|
||||
static Optional<PropertyDescriptor> string_get_own_property(GlobalObject& global_object, StringObject const& string, PropertyKey const& property_name)
|
||||
static Optional<PropertyDescriptor> string_get_own_property(GlobalObject& global_object, StringObject const& string, PropertyKey const& property_key)
|
||||
{
|
||||
// 1. Assert: S is an Object that has a [[StringData]] internal slot.
|
||||
// 2. Assert: IsPropertyKey(P) is true.
|
||||
VERIFY(property_name.is_valid());
|
||||
VERIFY(property_key.is_valid());
|
||||
|
||||
// 3. If Type(P) is not String, return undefined.
|
||||
// NOTE: The spec only uses string and symbol keys, and later coerces to numbers -
|
||||
// this is not the case for PropertyKey, so '!property_name.is_string()' would be wrong.
|
||||
if (property_name.is_symbol())
|
||||
// this is not the case for PropertyKey, so '!property_key.is_string()' would be wrong.
|
||||
if (property_key.is_symbol())
|
||||
return {};
|
||||
|
||||
// 4. Let index be ! CanonicalNumericIndexString(P).
|
||||
auto index = canonical_numeric_index_string(global_object, property_name);
|
||||
auto index = canonical_numeric_index_string(global_object, property_key);
|
||||
// 5. If index is undefined, return undefined.
|
||||
if (index.is_undefined())
|
||||
return {};
|
||||
|
@ -92,29 +92,29 @@ static Optional<PropertyDescriptor> string_get_own_property(GlobalObject& global
|
|||
}
|
||||
|
||||
// 10.4.3.1 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-string-exotic-objects-getownproperty-p
|
||||
ThrowCompletionOr<Optional<PropertyDescriptor>> StringObject::internal_get_own_property(PropertyKey const& property_name) const
|
||||
ThrowCompletionOr<Optional<PropertyDescriptor>> StringObject::internal_get_own_property(PropertyKey const& property_key) const
|
||||
{
|
||||
// Assert: IsPropertyKey(P) is true.
|
||||
|
||||
// 2. Let desc be OrdinaryGetOwnProperty(S, P).
|
||||
auto descriptor = MUST(Object::internal_get_own_property(property_name));
|
||||
auto descriptor = MUST(Object::internal_get_own_property(property_key));
|
||||
|
||||
// 3. If desc is not undefined, return desc.
|
||||
if (descriptor.has_value())
|
||||
return descriptor;
|
||||
|
||||
// 4. Return ! StringGetOwnProperty(S, P).
|
||||
return string_get_own_property(global_object(), *this, property_name);
|
||||
return string_get_own_property(global_object(), *this, property_key);
|
||||
}
|
||||
|
||||
// 10.4.3.2 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-string-exotic-objects-defineownproperty-p-desc
|
||||
ThrowCompletionOr<bool> StringObject::internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& property_descriptor)
|
||||
ThrowCompletionOr<bool> StringObject::internal_define_own_property(PropertyKey const& property_key, PropertyDescriptor const& property_descriptor)
|
||||
{
|
||||
// 1. Assert: IsPropertyKey(P) is true.
|
||||
VERIFY(property_name.is_valid());
|
||||
VERIFY(property_key.is_valid());
|
||||
|
||||
// 2. Let stringDesc be ! StringGetOwnProperty(S, P).
|
||||
auto string_descriptor = string_get_own_property(global_object(), *this, property_name);
|
||||
auto string_descriptor = string_get_own_property(global_object(), *this, property_key);
|
||||
|
||||
// 3. If stringDesc is not undefined, then
|
||||
if (string_descriptor.has_value()) {
|
||||
|
@ -126,7 +126,7 @@ ThrowCompletionOr<bool> StringObject::internal_define_own_property(PropertyKey c
|
|||
}
|
||||
|
||||
// 4. Return ! OrdinaryDefineOwnProperty(S, P, Desc).
|
||||
return Object::internal_define_own_property(property_name, property_descriptor);
|
||||
return Object::internal_define_own_property(property_key, property_descriptor);
|
||||
}
|
||||
|
||||
// 10.4.3.3 [[OwnPropertyKeys]] ( ), https://tc39.es/ecma262/#sec-string-exotic-objects-ownpropertykeys
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue