mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:12:43 +00:00 
			
		
		
		
	LibJS: Rename PropertyName to PropertyKey
Let's use the same name as the spec. :^)
This commit is contained in:
		
							parent
							
								
									715e7fada8
								
							
						
					
					
						commit
						398c181c79
					
				
					 55 changed files with 287 additions and 287 deletions
				
			
		|  | @ -1384,7 +1384,7 @@ static void generate_wrap_statement(SourceGenerator& generator, String const& va | |||
|         generate_wrap_statement(scoped_generator, String::formatted("element{}", recursion_depth), sequence_generic_type.parameters.first(), String::formatted("auto wrapped_element{} =", recursion_depth), WrappingReference::Yes, recursion_depth + 1); | ||||
| 
 | ||||
|         scoped_generator.append(R"~~~( | ||||
|         auto property_index@recursion_depth@ = JS::PropertyName { i@recursion_depth@ }; | ||||
|         auto property_index@recursion_depth@ = JS::PropertyKey { i@recursion_depth@ }; | ||||
|         MUST(new_array@recursion_depth@->create_data_property(property_index@recursion_depth@, wrapped_element@recursion_depth@)); | ||||
|     } | ||||
| 
 | ||||
|  | @ -1577,18 +1577,18 @@ public: | |||
| 
 | ||||
|     if (interface.extended_attributes.contains("CustomGet")) { | ||||
|         generator.append(R"~~~( | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyName const&, JS::Value receiver) const override; | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override; | ||||
| )~~~"); | ||||
|     } | ||||
|     if (interface.extended_attributes.contains("CustomSet")) { | ||||
|         generator.append(R"~~~( | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyName const&, JS::Value, JS::Value receiver) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value, JS::Value receiver) override; | ||||
| )~~~"); | ||||
|     } | ||||
| 
 | ||||
|     if (interface.extended_attributes.contains("CustomHasProperty")) { | ||||
|         generator.append(R"~~~( | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyName const&) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const&) const override; | ||||
| )~~~"); | ||||
|     } | ||||
| 
 | ||||
|  | @ -1600,10 +1600,10 @@ public: | |||
| 
 | ||||
|     if (interface.is_legacy_platform_object()) { | ||||
|         generator.append(R"~~~( | ||||
|     virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyName const&) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyName const&, JS::Value, JS::Value) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyName const&, JS::PropertyDescriptor const&) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyName const&) override; | ||||
|     virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const&) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value, JS::Value) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override; | ||||
|     virtual JS::ThrowCompletionOr<JS::MarkedValueList> internal_own_property_keys() const override; | ||||
| )~~~"); | ||||
|  | @ -1627,9 +1627,9 @@ private: | |||
| 
 | ||||
|     if (interface.is_legacy_platform_object()) { | ||||
|         generator.append(R"~~~( | ||||
|     bool is_named_property_exposed_on_object(JS::PropertyName const&) const; | ||||
|     Optional<JS::PropertyDescriptor> legacy_platform_object_get_own_property_for_get_own_property_slot(JS::PropertyName const&) const; | ||||
|     Optional<JS::PropertyDescriptor> legacy_platform_object_get_own_property_for_set_slot(JS::PropertyName const&) const; | ||||
|     bool is_named_property_exposed_on_object(JS::PropertyKey const&) const; | ||||
|     Optional<JS::PropertyDescriptor> legacy_platform_object_get_own_property_for_get_own_property_slot(JS::PropertyKey const&) const; | ||||
|     Optional<JS::PropertyDescriptor> legacy_platform_object_get_own_property_for_set_slot(JS::PropertyKey const&) const; | ||||
| )~~~"); | ||||
|     } | ||||
| 
 | ||||
|  | @ -1807,7 +1807,7 @@ static JS::Value wrap_for_legacy_platform_object_get_own_property(JS::GlobalObje | |||
|             // https://webidl.spec.whatwg.org/#dfn-named-property-visibility
 | ||||
| 
 | ||||
|             scoped_generator.append(R"~~~( | ||||
| bool @class_name@::is_named_property_exposed_on_object(JS::PropertyName const& property_name) const | ||||
| bool @class_name@::is_named_property_exposed_on_object(JS::PropertyKey const& property_name) const | ||||
| { | ||||
|     [[maybe_unused]] auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -1877,7 +1877,7 @@ bool @class_name@::is_named_property_exposed_on_object(JS::PropertyName const& p | |||
|             get_own_property_generator.set("internal_method"sv, for_which_internal_method); | ||||
| 
 | ||||
|             get_own_property_generator.append(R"~~~( | ||||
| Optional<JS::PropertyDescriptor> @class_name@::legacy_platform_object_get_own_property_for_@internal_method@_slot(JS::PropertyName const& property_name) const | ||||
| Optional<JS::PropertyDescriptor> @class_name@::legacy_platform_object_get_own_property_for_@internal_method@_slot(JS::PropertyKey const& property_name) const | ||||
| { | ||||
| )~~~"); | ||||
| 
 | ||||
|  | @ -2049,7 +2049,7 @@ Optional<JS::PropertyDescriptor> @class_name@::legacy_platform_object_get_own_pr | |||
| 
 | ||||
|         if (interface.named_property_setter.has_value()) { | ||||
|             // https://webidl.spec.whatwg.org/#invoke-named-setter
 | ||||
|             // NOTE: All users of invoke_named_property_setter check that JS::PropertyName is a String before calling it.
 | ||||
|             // NOTE: All users of invoke_named_property_setter check that JS::PropertyKey is a String before calling it.
 | ||||
|             // FIXME: It's not necessary to determine "creating" if the named property setter specifies an identifier.
 | ||||
|             //        Try avoiding it somehow, e.g. by enforcing supported_property_names doesn't have side effects so it can be skipped.
 | ||||
|             scoped_generator.append(R"~~~( | ||||
|  | @ -2109,7 +2109,7 @@ static void invoke_named_property_setter(JS::GlobalObject& global_object, @fully | |||
|             // FIXME: It's not necessary to determine "creating" if the indexed property setter specifies an identifier.
 | ||||
|             //        Try avoiding it somehow, e.g. by enforcing supported_property_indices doesn't have side effects so it can be skipped.
 | ||||
|             scoped_generator.append(R"~~~( | ||||
| static void invoke_indexed_property_setter(JS::GlobalObject& global_object, @fully_qualified_name@& impl, JS::PropertyName const& property_name, JS::Value value) | ||||
| static void invoke_indexed_property_setter(JS::GlobalObject& global_object, @fully_qualified_name@& impl, JS::PropertyKey const& property_name, JS::Value value) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  | @ -2165,7 +2165,7 @@ static void invoke_indexed_property_setter(JS::GlobalObject& global_object, @ful | |||
| 
 | ||||
|         // 3.9.1. [[GetOwnProperty]], https://webidl.spec.whatwg.org/#legacy-platform-object-getownproperty
 | ||||
|         scoped_generator.append(R"~~~( | ||||
| JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> @class_name@::internal_get_own_property(JS::PropertyName const& property_name) const | ||||
| JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> @class_name@::internal_get_own_property(JS::PropertyKey const& property_name) const | ||||
| { | ||||
|     // 1. Return LegacyPlatformObjectGetOwnProperty(O, P, false).
 | ||||
|     return legacy_platform_object_get_own_property_for_get_own_property_slot(property_name); | ||||
|  | @ -2174,7 +2174,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> @class_name@::internal_g | |||
| 
 | ||||
|         // 3.9.2. [[Set]], https://webidl.spec.whatwg.org/#legacy-platform-object-set
 | ||||
|         scoped_generator.append(R"~~~( | ||||
| JS::ThrowCompletionOr<bool> @class_name@::internal_set(JS::PropertyName const& property_name, JS::Value value, JS::Value receiver) | ||||
| JS::ThrowCompletionOr<bool> @class_name@::internal_set(JS::PropertyKey const& property_name, JS::Value value, JS::Value receiver) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     [[maybe_unused]] auto& global_object = this->global_object(); | ||||
|  | @ -2239,7 +2239,7 @@ JS::ThrowCompletionOr<bool> @class_name@::internal_set(JS::PropertyName const& p | |||
| 
 | ||||
|         // 3.9.3. [[DefineOwnProperty]], https://webidl.spec.whatwg.org/#legacy-platform-object-defineownproperty
 | ||||
|         scoped_generator.append(R"~~~( | ||||
| JS::ThrowCompletionOr<bool> @class_name@::internal_define_own_property(JS::PropertyName const& property_name, JS::PropertyDescriptor const& property_descriptor) | ||||
| JS::ThrowCompletionOr<bool> @class_name@::internal_define_own_property(JS::PropertyKey const& property_name, JS::PropertyDescriptor const& property_descriptor) | ||||
| { | ||||
|     [[maybe_unused]] auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -2363,7 +2363,7 @@ JS::ThrowCompletionOr<bool> @class_name@::internal_define_own_property(JS::Prope | |||
| 
 | ||||
|         // 3.9.4. [[Delete]], https://webidl.spec.whatwg.org/#legacy-platform-object-delete
 | ||||
|         scoped_generator.append(R"~~~( | ||||
| JS::ThrowCompletionOr<bool> @class_name@::internal_delete(JS::PropertyName const& property_name) | ||||
| JS::ThrowCompletionOr<bool> @class_name@::internal_delete(JS::PropertyKey const& property_name) | ||||
| { | ||||
|     [[maybe_unused]] auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  |  | |||
|  | @ -101,7 +101,7 @@ SheetGlobalObject::~SheetGlobalObject() | |||
| { | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_has_property(JS::PropertyName const& name) const | ||||
| JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_has_property(JS::PropertyKey const& name) const | ||||
| { | ||||
|     if (name.is_string()) { | ||||
|         if (name.as_string() == "value") | ||||
|  | @ -112,7 +112,7 @@ JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_has_property(JS::Propert | |||
|     return Object::internal_has_property(name); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<JS::Value> SheetGlobalObject::internal_get(const JS::PropertyName& property_name, JS::Value receiver) const | ||||
| JS::ThrowCompletionOr<JS::Value> SheetGlobalObject::internal_get(const JS::PropertyKey& property_name, JS::Value receiver) const | ||||
| { | ||||
|     if (property_name.is_string()) { | ||||
|         if (property_name.as_string() == "value") { | ||||
|  | @ -131,7 +131,7 @@ JS::ThrowCompletionOr<JS::Value> SheetGlobalObject::internal_get(const JS::Prope | |||
|     return Base::internal_get(property_name, receiver); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_set(const JS::PropertyName& property_name, JS::Value value, JS::Value receiver) | ||||
| JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_set(const JS::PropertyKey& property_name, JS::Value value, JS::Value receiver) | ||||
| { | ||||
|     if (property_name.is_string()) { | ||||
|         if (auto pos = m_sheet.parse_cell_name(property_name.as_string()); pos.has_value()) { | ||||
|  |  | |||
|  | @ -27,9 +27,9 @@ public: | |||
| 
 | ||||
|     virtual ~SheetGlobalObject() override; | ||||
| 
 | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyName const& name) const override; | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyName const&, JS::Value receiver) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyName const&, JS::Value value, JS::Value receiver) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override; | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; | ||||
|     virtual void initialize_global_object() override; | ||||
| 
 | ||||
|     JS_DECLARE_OLD_NATIVE_FUNCTION(get_real_cell_contents); | ||||
|  |  | |||
|  | @ -648,7 +648,7 @@ RefPtr<Sheet> Sheet::from_xsv(const Reader::XSV& xsv, Workbook& workbook) | |||
| JsonObject Sheet::gather_documentation() const | ||||
| { | ||||
|     JsonObject object; | ||||
|     const JS::PropertyName doc_name { "__documentation" }; | ||||
|     const JS::PropertyKey doc_name { "__documentation" }; | ||||
| 
 | ||||
|     auto add_docs_from = [&](auto& it, auto& global_object) { | ||||
|         auto value = global_object.get(it.key).release_value(); | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ DebuggerGlobalJSObject::DebuggerGlobalJSObject() | |||
|     m_variables = lib->debug_info->get_variables_in_current_scope(regs); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<JS::Value> DebuggerGlobalJSObject::internal_get(JS::PropertyName const& property_name, JS::Value receiver) const | ||||
| JS::ThrowCompletionOr<JS::Value> DebuggerGlobalJSObject::internal_get(JS::PropertyKey const& property_name, JS::Value receiver) const | ||||
| { | ||||
|     if (m_variables.is_empty() || !property_name.is_string()) | ||||
|         return Base::internal_get(property_name, receiver); | ||||
|  | @ -40,7 +40,7 @@ JS::ThrowCompletionOr<JS::Value> DebuggerGlobalJSObject::internal_get(JS::Proper | |||
|     return vm().throw_completion<JS::TypeError>(const_cast<DebuggerGlobalJSObject&>(*this), move(error_string)); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> DebuggerGlobalJSObject::internal_set(JS::PropertyName const& property_name, JS::Value value, JS::Value receiver) | ||||
| JS::ThrowCompletionOr<bool> DebuggerGlobalJSObject::internal_set(JS::PropertyKey const& property_name, JS::Value value, JS::Value receiver) | ||||
| { | ||||
|     if (m_variables.is_empty() || !property_name.is_string()) | ||||
|         return Base::internal_set(property_name, value, receiver); | ||||
|  |  | |||
|  | @ -21,8 +21,8 @@ class DebuggerGlobalJSObject final | |||
| public: | ||||
|     DebuggerGlobalJSObject(); | ||||
| 
 | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyName const&, JS::Value receiver) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyName const&, JS::Value value, JS::Value receiver) override; | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; | ||||
| 
 | ||||
|     Optional<JS::Value> debugger_to_js(const Debug::DebugInfo::VariableInfo&) const; | ||||
|     Optional<u32> js_to_debugger(JS::Value value, const Debug::DebugInfo::VariableInfo&) const; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/Error.h> | ||||
| #include <LibJS/Runtime/PrimitiveString.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| 
 | ||||
| namespace HackStudio { | ||||
| 
 | ||||
|  | @ -29,7 +29,7 @@ DebuggerVariableJSObject::~DebuggerVariableJSObject() | |||
| { | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> DebuggerVariableJSObject::internal_set(const JS::PropertyName& property_name, JS::Value value, JS::Value) | ||||
| JS::ThrowCompletionOr<bool> DebuggerVariableJSObject::internal_set(const JS::PropertyKey& property_name, JS::Value value, JS::Value) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ public: | |||
| 
 | ||||
|     virtual const char* class_name() const override { return m_variable_info.type_name.characters(); } | ||||
| 
 | ||||
|     JS::ThrowCompletionOr<bool> internal_set(JS::PropertyName const&, JS::Value value, JS::Value receiver) override; | ||||
|     JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; | ||||
| 
 | ||||
| private: | ||||
|     DebuggerGlobalJSObject& debugger_object() const; | ||||
|  |  | |||
|  | @ -1084,7 +1084,7 @@ Reference MemberExpression::to_reference(Interpreter& interpreter, GlobalObject& | |||
| 
 | ||||
|     // From here on equivalent to
 | ||||
|     // 13.3.4 EvaluatePropertyAccessWithIdentifierKey ( baseValue, identifierName, strict ), https://tc39.es/ecma262/#sec-evaluate-property-access-with-identifier-key
 | ||||
|     PropertyName property_name; | ||||
|     PropertyKey property_name; | ||||
|     if (is_computed()) { | ||||
|         // Weird order which I can't quite find from the specs.
 | ||||
|         auto value = m_property->execute(interpreter, global_object); | ||||
|  | @ -1094,7 +1094,7 @@ Reference MemberExpression::to_reference(Interpreter& interpreter, GlobalObject& | |||
|         TRY_OR_DISCARD(require_object_coercible(global_object, base_value)); | ||||
| 
 | ||||
|         VERIFY(!value.is_empty()); | ||||
|         property_name = PropertyName::from_value(global_object, value); | ||||
|         property_name = PropertyKey::from_value(global_object, value); | ||||
|         if (interpreter.exception()) | ||||
|             return Reference {}; | ||||
|     } else if (is<PrivateIdentifier>(*m_property)) { | ||||
|  | @ -1191,7 +1191,7 @@ static ThrowCompletionOr<ClassElement::ClassElementName> class_key_to_property_n | |||
|     if (prop_key.is_object()) | ||||
|         prop_key = TRY(prop_key.to_primitive(global_object, Value::PreferredType::String)); | ||||
| 
 | ||||
|     auto property_key = PropertyName::from_value(global_object, prop_key); | ||||
|     auto property_key = PropertyKey::from_value(global_object, prop_key); | ||||
|     if (auto* exception = interpreter.exception()) | ||||
|         return throw_completion(exception->value()); | ||||
|     return ClassElement::ClassElementName { property_key }; | ||||
|  | @ -1211,7 +1211,7 @@ ThrowCompletionOr<ClassElement::ClassValue> ClassMethod::class_element_evaluatio | |||
| 
 | ||||
|     auto set_function_name = [&](String prefix = "") { | ||||
|         auto property_name = property_key.visit( | ||||
|             [&](PropertyName const& property_name) -> String { | ||||
|             [&](PropertyKey const& property_name) -> String { | ||||
|                 if (property_name.is_symbol()) { | ||||
|                     auto description = property_name.as_symbol()->description(); | ||||
|                     if (description.is_empty()) | ||||
|  | @ -1228,8 +1228,8 @@ ThrowCompletionOr<ClassElement::ClassValue> ClassMethod::class_element_evaluatio | |||
|         update_function_name(method_value, String::formatted("{}{}{}", prefix, prefix.is_empty() ? "" : " ", property_name)); | ||||
|     }; | ||||
| 
 | ||||
|     if (property_key.has<PropertyName>()) { | ||||
|         auto& property_name = property_key.get<PropertyName>(); | ||||
|     if (property_key.has<PropertyKey>()) { | ||||
|         auto& property_name = property_key.get<PropertyKey>(); | ||||
|         switch (kind()) { | ||||
|         case ClassMethod::Kind::Method: | ||||
|             set_function_name(); | ||||
|  | @ -1303,7 +1303,7 @@ ThrowCompletionOr<ClassElement::ClassValue> ClassField::class_element_evaluation | |||
|     if (m_initializer) { | ||||
|         auto copy_initializer = m_initializer; | ||||
|         auto name = property_key.visit( | ||||
|             [&](PropertyName const& property_name) -> String { | ||||
|             [&](PropertyKey const& property_name) -> String { | ||||
|                 return property_name.is_number() ? property_name.to_string() : property_name.to_string_or_symbol().to_display_string(); | ||||
|             }, | ||||
|             [&](PrivateName const& private_name) -> String { | ||||
|  | @ -2600,14 +2600,14 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o | |||
|         switch (property.type()) { | ||||
|         case ObjectProperty::Type::Getter: | ||||
|             VERIFY(value.is_function()); | ||||
|             object->define_direct_accessor(PropertyName::from_value(global_object, key), &value.as_function(), nullptr, Attribute::Configurable | Attribute::Enumerable); | ||||
|             object->define_direct_accessor(PropertyKey::from_value(global_object, key), &value.as_function(), nullptr, Attribute::Configurable | Attribute::Enumerable); | ||||
|             break; | ||||
|         case ObjectProperty::Type::Setter: | ||||
|             VERIFY(value.is_function()); | ||||
|             object->define_direct_accessor(PropertyName::from_value(global_object, key), nullptr, &value.as_function(), Attribute::Configurable | Attribute::Enumerable); | ||||
|             object->define_direct_accessor(PropertyKey::from_value(global_object, key), nullptr, &value.as_function(), Attribute::Configurable | Attribute::Enumerable); | ||||
|             break; | ||||
|         case ObjectProperty::Type::KeyValue: | ||||
|             object->define_direct_property(PropertyName::from_value(global_object, key), value, JS::default_attributes); | ||||
|             object->define_direct_property(PropertyKey::from_value(global_object, key), value, JS::default_attributes); | ||||
|             break; | ||||
|         case ObjectProperty::Type::Spread: | ||||
|         default: | ||||
|  | @ -2627,7 +2627,7 @@ void MemberExpression::dump(int indent) const | |||
|     m_property->dump(indent + 1); | ||||
| } | ||||
| 
 | ||||
| PropertyName MemberExpression::computed_property_name(Interpreter& interpreter, GlobalObject& global_object) const | ||||
| PropertyKey MemberExpression::computed_property_name(Interpreter& interpreter, GlobalObject& global_object) const | ||||
| { | ||||
|     if (!is_computed()) | ||||
|         return verify_cast<Identifier>(*m_property).string(); | ||||
|  | @ -2636,7 +2636,7 @@ PropertyName MemberExpression::computed_property_name(Interpreter& interpreter, | |||
|     if (interpreter.exception()) | ||||
|         return {}; | ||||
|     VERIFY(!value.is_empty()); | ||||
|     return PropertyName::from_value(global_object, value); | ||||
|     return PropertyKey::from_value(global_object, value); | ||||
| } | ||||
| 
 | ||||
| String MemberExpression::to_string_approximation() const | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| #include <AK/Vector.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Runtime/EnvironmentCoordinate.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| #include <LibJS/Runtime/Reference.h> | ||||
| #include <LibJS/Runtime/Value.h> | ||||
| #include <LibJS/SourceRange.h> | ||||
|  | @ -1036,7 +1036,7 @@ public: | |||
|     virtual ElementKind class_element_kind() const = 0; | ||||
|     bool is_static() const { return m_is_static; } | ||||
| 
 | ||||
|     using ClassElementName = Variant<PropertyName, PrivateName>; | ||||
|     using ClassElementName = Variant<PropertyKey, PrivateName>; | ||||
| 
 | ||||
|     struct ClassFieldDefinition { | ||||
|         ClassElementName name; | ||||
|  | @ -1558,7 +1558,7 @@ public: | |||
|     Expression const& object() const { return *m_object; } | ||||
|     Expression const& property() const { return *m_property; } | ||||
| 
 | ||||
|     PropertyName computed_property_name(Interpreter&, GlobalObject&) const; | ||||
|     PropertyKey computed_property_name(Interpreter&, GlobalObject&) const; | ||||
| 
 | ||||
|     String to_string_approximation() const; | ||||
| 
 | ||||
|  |  | |||
|  | @ -216,7 +216,7 @@ void CopyObjectExcludingProperties::execute_impl(Bytecode::Interpreter& interpre | |||
|             auto property_name_or_error = key.to_property_key(interpreter.global_object()); | ||||
|             if (property_name_or_error.is_error()) | ||||
|                 return; | ||||
|             PropertyName property_name = property_name_or_error.release_value(); | ||||
|             PropertyKey property_name = property_name_or_error.release_value(); | ||||
|             auto property_value_or_error = from_object->get(property_name); | ||||
|             if (property_value_or_error.is_error()) | ||||
|                 return; | ||||
|  |  | |||
|  | @ -163,7 +163,7 @@ class PromiseReactionJob; | |||
| class PromiseResolveThenableJob; | ||||
| class PropertyAttributes; | ||||
| class PropertyDescriptor; | ||||
| class PropertyName; | ||||
| class PropertyKey; | ||||
| class Realm; | ||||
| class Reference; | ||||
| class ScopeNode; | ||||
|  |  | |||
|  | @ -1384,7 +1384,7 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression() | |||
| 
 | ||||
|     // It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains any duplicate
 | ||||
|     // entries for "__proto__" and at least two of those entries were obtained from productions  of
 | ||||
|     // the form PropertyDefinition : PropertyName : AssignmentExpression .
 | ||||
|     // the form PropertyDefinition : PropertyKey : AssignmentExpression .
 | ||||
|     bool has_direct_proto_property = false; | ||||
| 
 | ||||
|     while (!done() && !match(TokenType::CurlyClose)) { | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ | |||
| #include <LibJS/Runtime/Object.h> | ||||
| #include <LibJS/Runtime/ObjectEnvironment.h> | ||||
| #include <LibJS/Runtime/PropertyDescriptor.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| #include <LibJS/Runtime/ProxyObject.h> | ||||
| #include <LibJS/Runtime/Reference.h> | ||||
| 
 | ||||
|  | @ -106,7 +106,7 @@ ThrowCompletionOr<MarkedValueList> create_list_from_array_like(GlobalObject& glo | |||
|     // 6. Repeat, while index < len,
 | ||||
|     for (size_t i = 0; i < length; ++i) { | ||||
|         // a. Let indexName be ! ToString(𝔽(index)).
 | ||||
|         auto index_name = PropertyName { i }; | ||||
|         auto index_name = PropertyKey { i }; | ||||
| 
 | ||||
|         // b. Let next be ? Get(obj, indexName).
 | ||||
|         auto next = TRY(array_like.get(index_name)); | ||||
|  | @ -206,7 +206,7 @@ bool is_compatible_property_descriptor(bool extensible, PropertyDescriptor const | |||
| } | ||||
| 
 | ||||
| // 10.1.6.3 ValidateAndApplyPropertyDescriptor ( O, P, extensible, Desc, current ), https://tc39.es/ecma262/#sec-validateandapplypropertydescriptor
 | ||||
| bool validate_and_apply_property_descriptor(Object* object, PropertyName const& property_name, bool extensible, PropertyDescriptor const& descriptor, Optional<PropertyDescriptor> const& current) | ||||
| bool validate_and_apply_property_descriptor(Object* object, PropertyKey const& property_name, bool extensible, PropertyDescriptor const& descriptor, Optional<PropertyDescriptor> const& current) | ||||
| { | ||||
|     // 1. Assert: If O is not undefined, then IsPropertyKey(P) is true.
 | ||||
|     if (object) | ||||
|  | @ -835,7 +835,7 @@ Object* create_mapped_arguments_object(GlobalObject& global_object, FunctionObje | |||
|             // 2. Let p be MakeArgSetter(name, env).
 | ||||
|             // 3. Perform map.[[DefineOwnProperty]](! ToString(𝔽(index)), PropertyDescriptor { [[Set]]: p, [[Get]]: g, [[Enumerable]]: false, [[Configurable]]: true }).
 | ||||
|             object->parameter_map().define_old_native_accessor( | ||||
|                 PropertyName { index }, | ||||
|                 PropertyKey { index }, | ||||
|                 [&environment, name](VM&, GlobalObject& global_object_getter) -> Value { | ||||
|                     return MUST(environment.get_binding_value(global_object_getter, name, false)); | ||||
|                 }, | ||||
|  | @ -859,7 +859,7 @@ Object* create_mapped_arguments_object(GlobalObject& global_object, FunctionObje | |||
| } | ||||
| 
 | ||||
| // 7.1.21 CanonicalNumericIndexString ( argument ), https://tc39.es/ecma262/#sec-canonicalnumericindexstring
 | ||||
| Value canonical_numeric_index_string(GlobalObject& global_object, PropertyName const& property_name) | ||||
| Value canonical_numeric_index_string(GlobalObject& global_object, PropertyKey const& property_name) | ||||
| { | ||||
|     // NOTE: If the property name is a number type (An implementation-defined optimized
 | ||||
|     // property key type), it can be treated as a string property that has already been
 | ||||
|  |  | |||
|  | @ -30,11 +30,11 @@ ThrowCompletionOr<MarkedValueList> create_list_from_array_like(GlobalObject&, Va | |||
| ThrowCompletionOr<FunctionObject*> species_constructor(GlobalObject&, Object const&, FunctionObject& default_constructor); | ||||
| ThrowCompletionOr<Realm*> get_function_realm(GlobalObject&, FunctionObject const&); | ||||
| bool is_compatible_property_descriptor(bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current); | ||||
| bool validate_and_apply_property_descriptor(Object*, PropertyName const&, bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current); | ||||
| bool validate_and_apply_property_descriptor(Object*, PropertyKey const&, bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current); | ||||
| ThrowCompletionOr<Object*> get_prototype_from_constructor(GlobalObject&, FunctionObject const& constructor, Object* (GlobalObject::*intrinsic_default_prototype)()); | ||||
| Object* create_unmapped_arguments_object(GlobalObject&, Span<Value> arguments); | ||||
| Object* create_mapped_arguments_object(GlobalObject&, FunctionObject&, Vector<FunctionNode::Parameter> const&, Span<Value> arguments, Environment&); | ||||
| Value canonical_numeric_index_string(GlobalObject&, PropertyName const&); | ||||
| Value canonical_numeric_index_string(GlobalObject&, PropertyKey const&); | ||||
| ThrowCompletionOr<String> get_substitution(GlobalObject&, Utf16View const& matched, Utf16View const& str, size_t position, Span<Value> captures, Value named_captures, Value replacement); | ||||
| 
 | ||||
| enum class CallerMode { | ||||
|  |  | |||
|  | @ -35,7 +35,7 @@ void ArgumentsObject::visit_edges(Cell::Visitor& visitor) | |||
| } | ||||
| 
 | ||||
| // 10.4.4.3 [[Get]] ( P, Receiver ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-get-p-receiver
 | ||||
| ThrowCompletionOr<Value> ArgumentsObject::internal_get(PropertyName const& property_name, Value receiver) const | ||||
| ThrowCompletionOr<Value> ArgumentsObject::internal_get(PropertyKey const& property_name, Value receiver) const | ||||
| { | ||||
|     // 1. Let map be args.[[ParameterMap]].
 | ||||
|     auto& map = *m_parameter_map; | ||||
|  | @ -56,7 +56,7 @@ ThrowCompletionOr<Value> ArgumentsObject::internal_get(PropertyName const& prope | |||
| } | ||||
| 
 | ||||
| // 10.4.4.4 [[Set]] ( P, V, Receiver ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-set-p-v-receiver
 | ||||
| ThrowCompletionOr<bool> ArgumentsObject::internal_set(PropertyName const& property_name, Value value, Value receiver) | ||||
| ThrowCompletionOr<bool> ArgumentsObject::internal_set(PropertyKey const& property_name, Value value, Value receiver) | ||||
| { | ||||
|     bool is_mapped = false; | ||||
| 
 | ||||
|  | @ -84,7 +84,7 @@ ThrowCompletionOr<bool> ArgumentsObject::internal_set(PropertyName const& proper | |||
| } | ||||
| 
 | ||||
| // 10.4.4.5 [[Delete]] ( P ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-delete-p
 | ||||
| ThrowCompletionOr<bool> ArgumentsObject::internal_delete(PropertyName const& property_name) | ||||
| ThrowCompletionOr<bool> ArgumentsObject::internal_delete(PropertyKey const& property_name) | ||||
| { | ||||
|     // 1. Let map be args.[[ParameterMap]].
 | ||||
|     auto& map = parameter_map(); | ||||
|  | @ -106,7 +106,7 @@ ThrowCompletionOr<bool> ArgumentsObject::internal_delete(PropertyName const& pro | |||
| } | ||||
| 
 | ||||
| // 10.4.4.1 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-getownproperty-p
 | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> ArgumentsObject::internal_get_own_property(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> ArgumentsObject::internal_get_own_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     // 1. Let desc be OrdinaryGetOwnProperty(args, P).
 | ||||
|     auto desc = MUST(Object::internal_get_own_property(property_name)); | ||||
|  | @ -130,7 +130,7 @@ ThrowCompletionOr<Optional<PropertyDescriptor>> ArgumentsObject::internal_get_ow | |||
| } | ||||
| 
 | ||||
| // 10.4.4.2 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-arguments-exotic-objects-defineownproperty-p-desc
 | ||||
| ThrowCompletionOr<bool> ArgumentsObject::internal_define_own_property(PropertyName const& property_name, PropertyDescriptor const& descriptor) | ||||
| ThrowCompletionOr<bool> ArgumentsObject::internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& descriptor) | ||||
| { | ||||
|     // 1. Let map be args.[[ParameterMap]].
 | ||||
|     auto& map = parameter_map(); | ||||
|  |  | |||
|  | @ -23,11 +23,11 @@ public: | |||
| 
 | ||||
|     Environment& environment() { return m_environment; } | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyName const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyName const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyName const&, Value receiver) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyName const&, Value value, Value receiver) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyName const&) override; | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override; | ||||
| 
 | ||||
|     // [[ParameterMap]]
 | ||||
|     Object& parameter_map() { return *m_parameter_map; } | ||||
|  |  | |||
|  | @ -151,7 +151,7 @@ ThrowCompletionOr<bool> Array::set_length(PropertyDescriptor const& property_des | |||
| } | ||||
| 
 | ||||
| // NON-STANDARD: Used to return the value of the ephemeral length property
 | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> Array::internal_get_own_property(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> Array::internal_get_own_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     if (property_name.is_string() && property_name.as_string() == vm.names.length.as_string()) | ||||
|  | @ -161,7 +161,7 @@ ThrowCompletionOr<Optional<PropertyDescriptor>> Array::internal_get_own_property | |||
| } | ||||
| 
 | ||||
| // 10.4.2.1 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-array-exotic-objects-defineownproperty-p-desc
 | ||||
| ThrowCompletionOr<bool> Array::internal_define_own_property(PropertyName const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| ThrowCompletionOr<bool> Array::internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -208,7 +208,7 @@ ThrowCompletionOr<bool> Array::internal_define_own_property(PropertyName const& | |||
| } | ||||
| 
 | ||||
| // NON-STANDARD: Used to reject deletes to ephemeral (non-configurable) length property
 | ||||
| ThrowCompletionOr<bool> Array::internal_delete(PropertyName const& property_name) | ||||
| ThrowCompletionOr<bool> Array::internal_delete(PropertyKey const& property_name) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     if (property_name.is_string() && property_name.as_string() == vm.names.length.as_string()) | ||||
|  |  | |||
|  | @ -38,9 +38,9 @@ public: | |||
|     explicit Array(Object& prototype); | ||||
|     virtual ~Array() override; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyName const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyName const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyName const&) override; | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override; | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override; | ||||
| 
 | ||||
|     [[nodiscard]] bool length_is_writable() const { return m_length_writable; }; | ||||
|  |  | |||
|  | @ -169,7 +169,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::filter) | |||
|     // 7. Repeat, while k < len,
 | ||||
|     for (; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -219,7 +219,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::for_each) | |||
|     // 5. Repeat, while k < len,
 | ||||
|     for (size_t k = 0; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -263,7 +263,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map) | |||
|     // 6. Repeat, while k < len,
 | ||||
|     for (size_t k = 0; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -611,7 +611,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::index_of) | |||
| 
 | ||||
|     // 10. Repeat, while k < len,
 | ||||
|     for (; k < length; ++k) { | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // a. Let kPresent be ? HasProperty(O, ! ToString(𝔽(k))).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -675,7 +675,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce) | |||
|         // b. Repeat, while kPresent is false and k < len,
 | ||||
|         for (; !k_present && k < length; ++k) { | ||||
|             // i. Let Pk be ! ToString(𝔽(k)).
 | ||||
|             auto property_name = PropertyName { k }; | ||||
|             auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|             // ii. Set kPresent to ? HasProperty(O, Pk).
 | ||||
|             k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -697,7 +697,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce) | |||
|     // 9. Repeat, while k < len,
 | ||||
|     for (; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -757,7 +757,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right) | |||
|         // b. Repeat, while kPresent is false and k ≥ 0,
 | ||||
|         for (; !k_present && k >= 0; --k) { | ||||
|             // i. Let Pk be ! ToString(𝔽(k)).
 | ||||
|             auto property_name = PropertyName { k }; | ||||
|             auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|             // ii. Set kPresent to ? HasProperty(O, Pk).
 | ||||
|             k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -779,7 +779,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right) | |||
|     // 9. Repeat, while k ≥ 0,
 | ||||
|     for (; k >= 0; --k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -1015,7 +1015,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::last_index_of) | |||
| 
 | ||||
|     // 8. Repeat, while k ≥ 0,
 | ||||
|     for (; k >= 0; --k) { | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // a. Let kPresent be ? HasProperty(O, ! ToString(𝔽(k))).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -1091,7 +1091,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find) | |||
|     // 5. Repeat, while k < len,
 | ||||
|     for (size_t k = 0; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kValue be ? Get(O, Pk).
 | ||||
|         auto k_value = TRY(object->get(property_name)); | ||||
|  | @ -1130,7 +1130,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_index) | |||
|     // 5. Repeat, while k < len,
 | ||||
|     for (size_t k = 0; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kValue be ? Get(O, Pk).
 | ||||
|         auto k_value = TRY(object->get(property_name)); | ||||
|  | @ -1169,7 +1169,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last) | |||
|     // 5. Repeat, while k ≥ 0,
 | ||||
|     for (i64 k = static_cast<i64>(length) - 1; k >= 0; --k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kValue be ? Get(O, Pk).
 | ||||
|         auto k_value = TRY(object->get(property_name)); | ||||
|  | @ -1208,7 +1208,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last_index) | |||
|     // 5. Repeat, while k ≥ 0,
 | ||||
|     for (i64 k = static_cast<i64>(length) - 1; k >= 0; --k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kValue be ? Get(O, Pk).
 | ||||
|         auto k_value = TRY(object->get(property_name)); | ||||
|  | @ -1247,7 +1247,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::some) | |||
|     // 5. Repeat, while k < len,
 | ||||
|     for (size_t k = 0; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  | @ -1292,7 +1292,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every) | |||
|     // 5. Repeat, while k < len,
 | ||||
|     for (size_t k = 0; k < length; ++k) { | ||||
|         // a. Let Pk be ! ToString(𝔽(k)).
 | ||||
|         auto property_name = PropertyName { k }; | ||||
|         auto property_name = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto k_present = TRY(object->has_property(property_name)); | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
|  | @ -487,28 +487,28 @@ namespace JS { | |||
|     P(zonedDateTimeISO) | ||||
| 
 | ||||
| struct CommonPropertyNames { | ||||
|     PropertyName and_ { "and", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName catch_ { "catch", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName delete_ { "delete", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName for_ { "for", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName or_ { "or", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName register_ { "register", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName return_ { "return", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName throw_ { "throw", PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyName xor_ { "xor", PropertyName::StringMayBeNumber::No }; | ||||
| #define __ENUMERATE(x) PropertyName x { #x, PropertyName::StringMayBeNumber::No }; | ||||
|     PropertyKey and_ { "and", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey catch_ { "catch", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey delete_ { "delete", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey for_ { "for", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey or_ { "or", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey register_ { "register", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey return_ { "return", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey throw_ { "throw", PropertyKey::StringMayBeNumber::No }; | ||||
|     PropertyKey xor_ { "xor", PropertyKey::StringMayBeNumber::No }; | ||||
| #define __ENUMERATE(x) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No }; | ||||
|     ENUMERATE_STANDARD_PROPERTY_NAMES(__ENUMERATE) | ||||
| #undef __ENUMERATE | ||||
| #define __JS_ENUMERATE(x, a, b, c, t) PropertyName x { #x, PropertyName::StringMayBeNumber::No }; | ||||
| #define __JS_ENUMERATE(x, a, b, c, t) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No }; | ||||
|     JS_ENUMERATE_BUILTIN_TYPES | ||||
| #undef __JS_ENUMERATE | ||||
| #define __JS_ENUMERATE(x, a, b, c) PropertyName x { #x, PropertyName::StringMayBeNumber::No }; | ||||
| #define __JS_ENUMERATE(x, a, b, c) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No }; | ||||
|     JS_ENUMERATE_INTL_OBJECTS | ||||
| #undef __JS_ENUMERATE | ||||
| #define __JS_ENUMERATE(x, a, b, c) PropertyName x { #x, PropertyName::StringMayBeNumber::No }; | ||||
| #define __JS_ENUMERATE(x, a, b, c) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No }; | ||||
|     JS_ENUMERATE_TEMPORAL_OBJECTS | ||||
| #undef __JS_ENUMERATE | ||||
| #define __JS_ENUMERATE(x, a) PropertyName x { #x, PropertyName::StringMayBeNumber::No }; | ||||
| #define __JS_ENUMERATE(x, a) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No }; | ||||
|     JS_ENUMERATE_WELL_KNOWN_SYMBOLS | ||||
| #undef __JS_ENUMERATE | ||||
| }; | ||||
|  |  | |||
|  | @ -276,7 +276,7 @@ void ECMAScriptFunctionObject::visit_edges(Visitor& visitor) | |||
|     visitor.visit(m_home_object); | ||||
| 
 | ||||
|     for (auto& field : m_fields) { | ||||
|         if (auto* property_name_ptr = field.name.get_pointer<PropertyName>(); property_name_ptr && property_name_ptr->is_symbol()) | ||||
|         if (auto* property_name_ptr = field.name.get_pointer<PropertyKey>(); property_name_ptr && property_name_ptr->is_symbol()) | ||||
|             visitor.visit(property_name_ptr->as_symbol()); | ||||
| 
 | ||||
|         visitor.visit(field.initializer); | ||||
|  |  | |||
|  | @ -59,12 +59,12 @@ public: | |||
|     void set_home_object(Object* home_object) { m_home_object = home_object; } | ||||
| 
 | ||||
|     struct InstanceField { | ||||
|         Variant<PropertyName, PrivateName> name; | ||||
|         Variant<PropertyKey, PrivateName> name; | ||||
|         ECMAScriptFunctionObject* initializer { nullptr }; | ||||
|     }; | ||||
| 
 | ||||
|     Vector<InstanceField> const& fields() const { return m_fields; } | ||||
|     void add_field(Variant<PropertyName, PrivateName> property_key, ECMAScriptFunctionObject* initializer); | ||||
|     void add_field(Variant<PropertyKey, PrivateName> property_key, ECMAScriptFunctionObject* initializer); | ||||
| 
 | ||||
|     Vector<PrivateElement> const& private_methods() const { return m_private_methods; } | ||||
|     void add_private_method(PrivateElement method) { m_private_methods.append(move(method)); }; | ||||
|  |  | |||
|  | @ -69,9 +69,9 @@ protected: | |||
|     virtual void visit_edges(Visitor&) override; | ||||
| 
 | ||||
|     template<typename ConstructorType> | ||||
|     void initialize_constructor(PropertyName const&, ConstructorType*&, Object* prototype); | ||||
|     void initialize_constructor(PropertyKey const&, ConstructorType*&, Object* prototype); | ||||
|     template<typename ConstructorType> | ||||
|     void add_constructor(PropertyName const&, ConstructorType*&, Object* prototype); | ||||
|     void add_constructor(PropertyKey const&, ConstructorType*&, Object* prototype); | ||||
| 
 | ||||
| private: | ||||
|     virtual bool is_global_object() const final { return true; } | ||||
|  | @ -133,7 +133,7 @@ private: | |||
| }; | ||||
| 
 | ||||
| template<typename ConstructorType> | ||||
| inline void GlobalObject::initialize_constructor(PropertyName const& property_name, ConstructorType*& constructor, Object* prototype) | ||||
| inline void GlobalObject::initialize_constructor(PropertyKey const& property_name, ConstructorType*& constructor, Object* prototype) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     constructor = heap().allocate<ConstructorType>(*this, *this); | ||||
|  | @ -148,7 +148,7 @@ inline void GlobalObject::initialize_constructor(PropertyName const& property_na | |||
| } | ||||
| 
 | ||||
| template<typename ConstructorType> | ||||
| inline void GlobalObject::add_constructor(PropertyName const& property_name, ConstructorType*& constructor, Object* prototype) | ||||
| inline void GlobalObject::add_constructor(PropertyKey const& property_name, ConstructorType*& constructor, Object* prototype) | ||||
| { | ||||
|     // Some constructors are pre-initialized separately.
 | ||||
|     if (!constructor) | ||||
|  | @ -165,7 +165,7 @@ template<> | |||
| inline bool Object::fast_is<GlobalObject>() const { return is_global_object(); } | ||||
| 
 | ||||
| template<typename... Args> | ||||
| [[nodiscard]] ALWAYS_INLINE ThrowCompletionOr<Value> Value::invoke(GlobalObject& global_object, PropertyName const& property_name, Args... args) | ||||
| [[nodiscard]] ALWAYS_INLINE ThrowCompletionOr<Value> Value::invoke(GlobalObject& global_object, PropertyKey const& property_name, Args... args) | ||||
| { | ||||
|     if constexpr (sizeof...(Args) > 0) { | ||||
|         MarkedValueList arglist { global_object.vm().heap() }; | ||||
|  |  | |||
|  | @ -219,7 +219,7 @@ ThrowCompletionOr<Vector<String>> canonicalize_locale_list(GlobalObject& global_ | |||
|     // 7. Repeat, while k < len,
 | ||||
|     for (size_t k = 0; k < length; ++k) { | ||||
|         // a. Let Pk be ToString(k).
 | ||||
|         auto property_key = PropertyName { k }; | ||||
|         auto property_key = PropertyKey { k }; | ||||
| 
 | ||||
|         // b. Let kPresent be ? HasProperty(O, Pk).
 | ||||
|         auto key_present = TRY(object->has_property(property_key)); | ||||
|  | @ -597,7 +597,7 @@ ThrowCompletionOr<Object*> coerce_options_to_object(GlobalObject& global_object, | |||
| } | ||||
| 
 | ||||
| // 9.2.13 GetOption ( options, property, type, values, fallback ), https://tc39.es/ecma402/#sec-getoption
 | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& options, PropertyName const& property, Value::Type type, Vector<StringView> const& values, Fallback fallback) | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, Value::Type type, Vector<StringView> const& values, Fallback fallback) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  | @ -661,7 +661,7 @@ ThrowCompletionOr<Optional<int>> default_number_option(GlobalObject& global_obje | |||
| } | ||||
| 
 | ||||
| // 9.2.15 GetNumberOption ( options, property, minimum, maximum, fallback ), https://tc39.es/ecma402/#sec-getnumberoption
 | ||||
| ThrowCompletionOr<Optional<int>> get_number_option(GlobalObject& global_object, Object const& options, PropertyName const& property, int minimum, int maximum, Optional<int> fallback) | ||||
| ThrowCompletionOr<Optional<int>> get_number_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, int minimum, int maximum, Optional<int> fallback) | ||||
| { | ||||
|     // 1. Assert: Type(options) is Object.
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -46,9 +46,9 @@ Vector<String> lookup_supported_locales(Vector<String> const& requested_locales) | |||
| Vector<String> best_fit_supported_locales(Vector<String> const& requested_locales); | ||||
| ThrowCompletionOr<Array*> supported_locales(GlobalObject&, Vector<String> const& requested_locales, Value options); | ||||
| ThrowCompletionOr<Object*> coerce_options_to_object(GlobalObject& global_object, Value options); | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& options, PropertyName const& property, Value::Type type, Vector<StringView> const& values, Fallback fallback); | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, Value::Type type, Vector<StringView> const& values, Fallback fallback); | ||||
| ThrowCompletionOr<Optional<int>> default_number_option(GlobalObject& global_object, Value value, int minimum, int maximum, Optional<int> fallback); | ||||
| ThrowCompletionOr<Optional<int>> get_number_option(GlobalObject& global_object, Object const& options, PropertyName const& property, int minimum, int maximum, Optional<int> fallback); | ||||
| ThrowCompletionOr<Optional<int>> get_number_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, int minimum, int maximum, Optional<int> fallback); | ||||
| Vector<PatternPartition> partition_pattern(StringView pattern); | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ struct LocaleAndKeys { | |||
| }; | ||||
| 
 | ||||
| // Note: This is not an AO in the spec. This just serves to abstract very similar steps in ApplyOptionsToTag and the Intl.Locale constructor.
 | ||||
| static ThrowCompletionOr<Optional<String>> get_string_option(GlobalObject& global_object, Object const& options, PropertyName const& property, Function<bool(StringView)> validator, Vector<StringView> const& values = {}) | ||||
| static ThrowCompletionOr<Optional<String>> get_string_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, Function<bool(StringView)> validator, Vector<StringView> const& values = {}) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -129,7 +129,7 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(JSONObject::stringify) | |||
| } | ||||
| 
 | ||||
| // 25.5.2.1 SerializeJSONProperty ( state, key, holder ), https://tc39.es/ecma262/#sec-serializejsonproperty
 | ||||
| String JSONObject::serialize_json_property(GlobalObject& global_object, StringifyState& state, const PropertyName& key, Object* holder) | ||||
| String JSONObject::serialize_json_property(GlobalObject& global_object, StringifyState& state, const PropertyKey& key, Object* holder) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     auto value = TRY_OR_DISCARD(holder->get(key)); | ||||
|  | @ -200,7 +200,7 @@ String JSONObject::serialize_json_object(GlobalObject& global_object, StringifyS | |||
|     state.indent = String::formatted("{}{}", state.indent, state.gap); | ||||
|     Vector<String> property_strings; | ||||
| 
 | ||||
|     auto process_property = [&](const PropertyName& key) { | ||||
|     auto process_property = [&](const PropertyKey& key) { | ||||
|         if (key.is_symbol()) | ||||
|             return; | ||||
|         auto serialized_property_string = serialize_json_property(global_object, state, key, &object); | ||||
|  | @ -437,7 +437,7 @@ Array* JSONObject::parse_json_array(GlobalObject& global_object, const JsonArray | |||
| } | ||||
| 
 | ||||
| // 25.5.1.1 InternalizeJSONProperty ( holder, name, reviver ), https://tc39.es/ecma262/#sec-internalizejsonproperty
 | ||||
| Value JSONObject::internalize_json_property(GlobalObject& global_object, Object* holder, PropertyName const& name, FunctionObject& reviver) | ||||
| Value JSONObject::internalize_json_property(GlobalObject& global_object, Object* holder, PropertyKey const& name, FunctionObject& reviver) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     auto value = TRY_OR_DISCARD(holder->get(name)); | ||||
|  | @ -445,7 +445,7 @@ Value JSONObject::internalize_json_property(GlobalObject& global_object, Object* | |||
|         auto is_array = TRY_OR_DISCARD(value.is_array(global_object)); | ||||
| 
 | ||||
|         auto& value_object = value.as_object(); | ||||
|         auto process_property = [&](const PropertyName& key) -> ThrowCompletionOr<void> { | ||||
|         auto process_property = [&](const PropertyKey& key) -> ThrowCompletionOr<void> { | ||||
|             auto element = internalize_json_property(global_object, &value_object, key, reviver); | ||||
|             if (auto* exception = vm.exception()) | ||||
|                 return throw_completion(exception->value()); | ||||
|  |  | |||
|  | @ -34,7 +34,7 @@ private: | |||
|     }; | ||||
| 
 | ||||
|     // Stringify helpers
 | ||||
|     static String serialize_json_property(GlobalObject&, StringifyState&, const PropertyName& key, Object* holder); | ||||
|     static String serialize_json_property(GlobalObject&, StringifyState&, const PropertyKey& key, Object* holder); | ||||
|     static String serialize_json_object(GlobalObject&, StringifyState&, Object&); | ||||
|     static String serialize_json_array(GlobalObject&, StringifyState&, Object&); | ||||
|     static String quote_json_string(String); | ||||
|  | @ -42,7 +42,7 @@ private: | |||
|     // Parse helpers
 | ||||
|     static Object* parse_json_object(GlobalObject&, const JsonObject&); | ||||
|     static Array* parse_json_array(GlobalObject&, const JsonArray&); | ||||
|     static Value internalize_json_property(GlobalObject&, Object* holder, PropertyName const& name, FunctionObject& reviver); | ||||
|     static Value internalize_json_property(GlobalObject&, Object* holder, PropertyKey const& name, FunctionObject& reviver); | ||||
| 
 | ||||
|     JS_DECLARE_OLD_NATIVE_FUNCTION(stringify); | ||||
|     JS_DECLARE_OLD_NATIVE_FUNCTION(parse); | ||||
|  |  | |||
|  | @ -77,7 +77,7 @@ ThrowCompletionOr<bool> Object::is_extensible() const | |||
| // 7.3 Operations on Objects, https://tc39.es/ecma262/#sec-operations-on-objects
 | ||||
| 
 | ||||
| // 7.3.2 Get ( O, P ), https://tc39.es/ecma262/#sec-get-o-p
 | ||||
| ThrowCompletionOr<Value> Object::get(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<Value> Object::get(PropertyKey const& property_name) const | ||||
| { | ||||
|     // 1. Assert: Type(O) is Object.
 | ||||
| 
 | ||||
|  | @ -91,7 +91,7 @@ ThrowCompletionOr<Value> Object::get(PropertyName const& property_name) const | |||
| // 7.3.3 GetV ( V, P ) is defined as Value::get().
 | ||||
| 
 | ||||
| // 7.3.4 Set ( O, P, V, Throw ), https://tc39.es/ecma262/#sec-set-o-p-v-throw
 | ||||
| ThrowCompletionOr<bool> Object::set(PropertyName const& property_name, Value value, ShouldThrowExceptions throw_exceptions) | ||||
| ThrowCompletionOr<bool> Object::set(PropertyKey const& property_name, Value value, ShouldThrowExceptions throw_exceptions) | ||||
| { | ||||
|     VERIFY(!value.is_empty()); | ||||
|     auto& vm = this->vm(); | ||||
|  | @ -117,7 +117,7 @@ ThrowCompletionOr<bool> Object::set(PropertyName const& property_name, Value val | |||
| } | ||||
| 
 | ||||
| // 7.3.5 CreateDataProperty ( O, P, V ), https://tc39.es/ecma262/#sec-createdataproperty
 | ||||
| ThrowCompletionOr<bool> Object::create_data_property(PropertyName const& property_name, Value value) | ||||
| ThrowCompletionOr<bool> Object::create_data_property(PropertyKey const& property_name, Value value) | ||||
| { | ||||
|     // 1. Assert: Type(O) is Object.
 | ||||
| 
 | ||||
|  | @ -137,7 +137,7 @@ ThrowCompletionOr<bool> Object::create_data_property(PropertyName const& propert | |||
| } | ||||
| 
 | ||||
| // 7.3.6 CreateMethodProperty ( O, P, V ), https://tc39.es/ecma262/#sec-createmethodproperty
 | ||||
| ThrowCompletionOr<bool> Object::create_method_property(PropertyName const& property_name, Value value) | ||||
| ThrowCompletionOr<bool> Object::create_method_property(PropertyKey const& property_name, Value value) | ||||
| { | ||||
|     VERIFY(!value.is_empty()); | ||||
| 
 | ||||
|  | @ -159,7 +159,7 @@ ThrowCompletionOr<bool> Object::create_method_property(PropertyName const& prope | |||
| } | ||||
| 
 | ||||
| // 7.3.7 CreateDataPropertyOrThrow ( O, P, V ), https://tc39.es/ecma262/#sec-createdatapropertyorthrow
 | ||||
| ThrowCompletionOr<bool> Object::create_data_property_or_throw(PropertyName const& property_name, Value value) | ||||
| ThrowCompletionOr<bool> Object::create_data_property_or_throw(PropertyKey const& property_name, Value value) | ||||
| { | ||||
|     VERIFY(!value.is_empty()); | ||||
|     auto& vm = this->vm(); | ||||
|  | @ -183,7 +183,7 @@ ThrowCompletionOr<bool> Object::create_data_property_or_throw(PropertyName const | |||
| } | ||||
| 
 | ||||
| // 7.3.6 CreateNonEnumerableDataPropertyOrThrow ( O, P, V ), https://tc39.es/proposal-error-cause/#sec-createnonenumerabledatapropertyorthrow
 | ||||
| ThrowCompletionOr<bool> Object::create_non_enumerable_data_property_or_throw(PropertyName const& property_name, Value value) | ||||
| ThrowCompletionOr<bool> Object::create_non_enumerable_data_property_or_throw(PropertyKey const& property_name, Value value) | ||||
| { | ||||
|     VERIFY(!value.is_empty()); | ||||
|     VERIFY(property_name.is_valid()); | ||||
|  | @ -196,7 +196,7 @@ ThrowCompletionOr<bool> Object::create_non_enumerable_data_property_or_throw(Pro | |||
| } | ||||
| 
 | ||||
| // 7.3.8 DefinePropertyOrThrow ( O, P, desc ), https://tc39.es/ecma262/#sec-definepropertyorthrow
 | ||||
| ThrowCompletionOr<bool> Object::define_property_or_throw(PropertyName const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| ThrowCompletionOr<bool> Object::define_property_or_throw(PropertyKey const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -219,7 +219,7 @@ ThrowCompletionOr<bool> Object::define_property_or_throw(PropertyName const& pro | |||
| } | ||||
| 
 | ||||
| // 7.3.9 DeletePropertyOrThrow ( O, P ), https://tc39.es/ecma262/#sec-deletepropertyorthrow
 | ||||
| ThrowCompletionOr<bool> Object::delete_property_or_throw(PropertyName const& property_name) | ||||
| ThrowCompletionOr<bool> Object::delete_property_or_throw(PropertyKey const& property_name) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -242,7 +242,7 @@ ThrowCompletionOr<bool> Object::delete_property_or_throw(PropertyName const& pro | |||
| } | ||||
| 
 | ||||
| // 7.3.11 HasProperty ( O, P ), https://tc39.es/ecma262/#sec-hasproperty
 | ||||
| ThrowCompletionOr<bool> Object::has_property(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<bool> Object::has_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     // 1. Assert: Type(O) is Object.
 | ||||
| 
 | ||||
|  | @ -254,7 +254,7 @@ ThrowCompletionOr<bool> Object::has_property(PropertyName const& property_name) | |||
| } | ||||
| 
 | ||||
| // 7.3.12 HasOwnProperty ( O, P ), https://tc39.es/ecma262/#sec-hasownproperty
 | ||||
| ThrowCompletionOr<bool> Object::has_own_property(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<bool> Object::has_own_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     // 1. Assert: Type(O) is Object.
 | ||||
| 
 | ||||
|  | @ -296,7 +296,7 @@ ThrowCompletionOr<bool> Object::set_integrity_level(IntegrityLevel level) | |||
|     if (level == IntegrityLevel::Sealed) { | ||||
|         // a. For each element k of keys, do
 | ||||
|         for (auto& key : keys) { | ||||
|             auto property_name = PropertyName::from_value(global_object, key); | ||||
|             auto property_name = PropertyKey::from_value(global_object, key); | ||||
| 
 | ||||
|             // i. Perform ? DefinePropertyOrThrow(O, k, PropertyDescriptor { [[Configurable]]: false }).
 | ||||
|             TRY(define_property_or_throw(property_name, { .configurable = false })); | ||||
|  | @ -308,7 +308,7 @@ ThrowCompletionOr<bool> Object::set_integrity_level(IntegrityLevel level) | |||
| 
 | ||||
|         // b. For each element k of keys, do
 | ||||
|         for (auto& key : keys) { | ||||
|             auto property_name = PropertyName::from_value(global_object, key); | ||||
|             auto property_name = PropertyKey::from_value(global_object, key); | ||||
| 
 | ||||
|             // i. Let currentDesc be ? O.[[GetOwnProperty]](k).
 | ||||
|             auto current_descriptor = TRY(internal_get_own_property(property_name)); | ||||
|  | @ -360,7 +360,7 @@ ThrowCompletionOr<bool> Object::test_integrity_level(IntegrityLevel level) const | |||
| 
 | ||||
|     // 7. For each element k of keys, do
 | ||||
|     for (auto& key : keys) { | ||||
|         auto property_name = PropertyName::from_value(global_object(), key); | ||||
|         auto property_name = PropertyKey::from_value(global_object(), key); | ||||
| 
 | ||||
|         // a. Let currentDesc be ? O.[[GetOwnProperty]](k).
 | ||||
|         auto current_descriptor = TRY(internal_get_own_property(property_name)); | ||||
|  | @ -405,7 +405,7 @@ ThrowCompletionOr<MarkedValueList> Object::enumerable_own_property_names(Propert | |||
|         // a. If Type(key) is String, then
 | ||||
|         if (!key.is_string()) | ||||
|             continue; | ||||
|         auto property_name = PropertyName::from_value(global_object, key); | ||||
|         auto property_name = PropertyKey::from_value(global_object, key); | ||||
| 
 | ||||
|         // i. Let desc be ? O.[[GetOwnProperty]](key).
 | ||||
|         auto descriptor = TRY(internal_get_own_property(property_name)); | ||||
|  | @ -445,7 +445,7 @@ ThrowCompletionOr<MarkedValueList> Object::enumerable_own_property_names(Propert | |||
| } | ||||
| 
 | ||||
| // 7.3.25 CopyDataProperties ( target, source, excludedItems ), https://tc39.es/ecma262/#sec-copydataproperties
 | ||||
| ThrowCompletionOr<Object*> Object::copy_data_properties(Value source, HashTable<PropertyName, PropertyNameTraits> const& seen_names, GlobalObject& global_object) | ||||
| ThrowCompletionOr<Object*> Object::copy_data_properties(Value source, HashTable<PropertyKey, PropertyNameTraits> const& seen_names, GlobalObject& global_object) | ||||
| { | ||||
|     if (source.is_nullish()) | ||||
|         return this; | ||||
|  | @ -453,7 +453,7 @@ ThrowCompletionOr<Object*> Object::copy_data_properties(Value source, HashTable< | |||
|     auto* from_object = MUST(source.to_object(global_object)); | ||||
| 
 | ||||
|     for (auto& next_key_value : TRY(from_object->internal_own_property_keys())) { | ||||
|         auto next_key = PropertyName::from_value(global_object, next_key_value); | ||||
|         auto next_key = PropertyKey::from_value(global_object, next_key_value); | ||||
|         if (seen_names.contains(next_key)) | ||||
|             continue; | ||||
| 
 | ||||
|  | @ -547,13 +547,13 @@ ThrowCompletionOr<void> Object::private_set(PrivateName const& name, Value value | |||
| } | ||||
| 
 | ||||
| // 7.3.31 DefineField ( receiver, fieldRecord ), https://tc39.es/ecma262/#sec-definefield
 | ||||
| ThrowCompletionOr<void> Object::define_field(Variant<PropertyName, PrivateName> name, ECMAScriptFunctionObject* initializer) | ||||
| ThrowCompletionOr<void> Object::define_field(Variant<PropertyKey, PrivateName> name, ECMAScriptFunctionObject* initializer) | ||||
| { | ||||
|     Value init_value = js_undefined(); | ||||
|     if (initializer) | ||||
|         init_value = TRY(vm().call(*initializer, this)); | ||||
| 
 | ||||
|     if (auto* property_name_ptr = name.get_pointer<PropertyName>()) | ||||
|     if (auto* property_name_ptr = name.get_pointer<PropertyKey>()) | ||||
|         TRY(create_data_property_or_throw(*property_name_ptr, init_value)); | ||||
|     else | ||||
|         TRY(private_field_add(name.get<PrivateName>(), init_value)); | ||||
|  | @ -634,7 +634,7 @@ ThrowCompletionOr<bool> Object::internal_prevent_extensions() | |||
| } | ||||
| 
 | ||||
| // 10.1.5 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p
 | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> Object::internal_get_own_property(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> Object::internal_get_own_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|     VERIFY(property_name.is_valid()); | ||||
|  | @ -680,7 +680,7 @@ ThrowCompletionOr<Optional<PropertyDescriptor>> Object::internal_get_own_propert | |||
| } | ||||
| 
 | ||||
| // 10.1.6 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
 | ||||
| ThrowCompletionOr<bool> Object::internal_define_own_property(PropertyName const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| ThrowCompletionOr<bool> Object::internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| { | ||||
|     VERIFY(property_name.is_valid()); | ||||
|     // 1. Let current be ? O.[[GetOwnProperty]](P).
 | ||||
|  | @ -694,7 +694,7 @@ ThrowCompletionOr<bool> Object::internal_define_own_property(PropertyName const& | |||
| } | ||||
| 
 | ||||
| // 10.1.7 [[HasProperty]] ( P ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-hasproperty-p
 | ||||
| ThrowCompletionOr<bool> Object::internal_has_property(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<bool> Object::internal_has_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -725,7 +725,7 @@ ThrowCompletionOr<bool> Object::internal_has_property(PropertyName const& proper | |||
| } | ||||
| 
 | ||||
| // 10.1.8 [[Get]] ( P, Receiver ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-get-p-receiver
 | ||||
| ThrowCompletionOr<Value> Object::internal_get(PropertyName const& property_name, Value receiver) const | ||||
| ThrowCompletionOr<Value> Object::internal_get(PropertyKey const& property_name, Value receiver) const | ||||
| { | ||||
|     VERIFY(!receiver.is_empty()); | ||||
|     auto& vm = this->vm(); | ||||
|  | @ -768,7 +768,7 @@ ThrowCompletionOr<Value> Object::internal_get(PropertyName const& property_name, | |||
| } | ||||
| 
 | ||||
| // 10.1.9 [[Set]] ( P, V, Receiver ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver
 | ||||
| ThrowCompletionOr<bool> Object::internal_set(PropertyName const& property_name, Value value, Value receiver) | ||||
| ThrowCompletionOr<bool> Object::internal_set(PropertyKey const& property_name, Value value, Value receiver) | ||||
| { | ||||
|     VERIFY(!value.is_empty()); | ||||
|     VERIFY(!receiver.is_empty()); | ||||
|  | @ -784,7 +784,7 @@ ThrowCompletionOr<bool> Object::internal_set(PropertyName const& property_name, | |||
| } | ||||
| 
 | ||||
| // 10.1.9.2 OrdinarySetWithOwnDescriptor ( O, P, V, Receiver, ownDesc ), https://tc39.es/ecma262/#sec-ordinarysetwithowndescriptor
 | ||||
| ThrowCompletionOr<bool> Object::ordinary_set_with_own_descriptor(PropertyName const& property_name, Value value, Value receiver, Optional<PropertyDescriptor> own_descriptor) | ||||
| ThrowCompletionOr<bool> Object::ordinary_set_with_own_descriptor(PropertyKey const& property_name, Value value, Value receiver, Optional<PropertyDescriptor> own_descriptor) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -870,7 +870,7 @@ ThrowCompletionOr<bool> Object::ordinary_set_with_own_descriptor(PropertyName co | |||
| } | ||||
| 
 | ||||
| // 10.1.10 [[Delete]] ( P ), https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-delete-p
 | ||||
| ThrowCompletionOr<bool> Object::internal_delete(PropertyName const& property_name) | ||||
| ThrowCompletionOr<bool> Object::internal_delete(PropertyKey const& property_name) | ||||
| { | ||||
|     // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|     VERIFY(property_name.is_valid()); | ||||
|  | @ -945,7 +945,7 @@ ThrowCompletionOr<bool> Object::set_immutable_prototype(Object* prototype) | |||
|     return false; | ||||
| } | ||||
| 
 | ||||
| Optional<ValueAndAttributes> Object::storage_get(PropertyName const& property_name) const | ||||
| Optional<ValueAndAttributes> Object::storage_get(PropertyKey const& property_name) const | ||||
| { | ||||
|     VERIFY(property_name.is_valid()); | ||||
| 
 | ||||
|  | @ -968,7 +968,7 @@ Optional<ValueAndAttributes> Object::storage_get(PropertyName const& property_na | |||
|     return ValueAndAttributes { .value = value, .attributes = attributes }; | ||||
| } | ||||
| 
 | ||||
| bool Object::storage_has(PropertyName const& property_name) const | ||||
| bool Object::storage_has(PropertyKey const& property_name) const | ||||
| { | ||||
|     VERIFY(property_name.is_valid()); | ||||
|     if (property_name.is_number()) | ||||
|  | @ -976,7 +976,7 @@ bool Object::storage_has(PropertyName const& property_name) const | |||
|     return shape().lookup(property_name.to_string_or_symbol()).has_value(); | ||||
| } | ||||
| 
 | ||||
| void Object::storage_set(PropertyName const& property_name, ValueAndAttributes const& value_and_attributes) | ||||
| void Object::storage_set(PropertyKey const& property_name, ValueAndAttributes const& value_and_attributes) | ||||
| { | ||||
|     VERIFY(property_name.is_valid()); | ||||
| 
 | ||||
|  | @ -1017,7 +1017,7 @@ void Object::storage_set(PropertyName const& property_name, ValueAndAttributes c | |||
|     m_storage[metadata->offset] = value; | ||||
| } | ||||
| 
 | ||||
| void Object::storage_delete(PropertyName const& property_name) | ||||
| void Object::storage_delete(PropertyKey const& property_name) | ||||
| { | ||||
|     VERIFY(property_name.is_valid()); | ||||
|     VERIFY(storage_has(property_name)); | ||||
|  | @ -1045,7 +1045,7 @@ void Object::set_prototype(Object* new_prototype) | |||
|         m_shape = shape.create_prototype_transition(new_prototype); | ||||
| } | ||||
| 
 | ||||
| void Object::define_old_native_accessor(PropertyName const& property_name, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attribute) | ||||
| void Object::define_old_native_accessor(PropertyKey const& property_name, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attribute) | ||||
| { | ||||
|     Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> completion_getter = {}; | ||||
|     if (getter) { | ||||
|  | @ -1068,7 +1068,7 @@ void Object::define_old_native_accessor(PropertyName const& property_name, Funct | |||
|     define_native_accessor(property_name, move(completion_getter), move(completion_setter), attribute); | ||||
| } | ||||
| 
 | ||||
| void Object::define_native_accessor(PropertyName const& property_name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> getter, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> setter, PropertyAttributes attribute) | ||||
| void Object::define_native_accessor(PropertyKey const& property_name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> getter, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> setter, PropertyAttributes attribute) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     String formatted_property_name; | ||||
|  | @ -1096,7 +1096,7 @@ void Object::define_native_accessor(PropertyName const& property_name, Function< | |||
|     return define_direct_accessor(property_name, getter_function, setter_function, attribute); | ||||
| } | ||||
| 
 | ||||
| void Object::define_direct_accessor(PropertyName const& property_name, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes) | ||||
| void Object::define_direct_accessor(PropertyKey const& property_name, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes) | ||||
| { | ||||
|     VERIFY(property_name.is_valid()); | ||||
| 
 | ||||
|  | @ -1122,7 +1122,7 @@ void Object::ensure_shape_is_unique() | |||
| } | ||||
| 
 | ||||
| // Simple side-effect free property lookup, following the prototype chain. Non-standard.
 | ||||
| Value Object::get_without_side_effects(const PropertyName& property_name) const | ||||
| Value Object::get_without_side_effects(const PropertyKey& property_name) const | ||||
| { | ||||
|     auto* object = this; | ||||
|     while (object) { | ||||
|  | @ -1134,7 +1134,7 @@ Value Object::get_without_side_effects(const PropertyName& property_name) const | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void Object::define_old_native_function(PropertyName const& property_name, Function<Value(VM&, GlobalObject&)> native_function, i32 length, PropertyAttributes attribute) | ||||
| void Object::define_old_native_function(PropertyKey const& property_name, Function<Value(VM&, GlobalObject&)> native_function, i32 length, PropertyAttributes attribute) | ||||
| { | ||||
|     auto completion_native_function = [native_function = move(native_function), property_name](auto& vm, auto& global_object) -> ThrowCompletionOr<Value> { | ||||
|         auto result = native_function(vm, global_object); | ||||
|  | @ -1145,7 +1145,7 @@ void Object::define_old_native_function(PropertyName const& property_name, Funct | |||
|     define_native_function(property_name, move(completion_native_function), length, attribute); | ||||
| } | ||||
| 
 | ||||
| void Object::define_native_function(PropertyName const& property_name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> native_function, i32 length, PropertyAttributes attribute) | ||||
| void Object::define_native_function(PropertyKey const& property_name, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> native_function, i32 length, PropertyAttributes attribute) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     String function_name; | ||||
|  | @ -1174,7 +1174,7 @@ ThrowCompletionOr<Object*> Object::define_properties(Value properties) | |||
|     auto keys = TRY(props->internal_own_property_keys()); | ||||
| 
 | ||||
|     struct NameAndDescriptor { | ||||
|         PropertyName name; | ||||
|         PropertyKey name; | ||||
|         PropertyDescriptor descriptor; | ||||
|     }; | ||||
| 
 | ||||
|  | @ -1183,7 +1183,7 @@ ThrowCompletionOr<Object*> Object::define_properties(Value properties) | |||
| 
 | ||||
|     // 5. For each element nextKey of keys, do
 | ||||
|     for (auto& next_key : keys) { | ||||
|         auto property_name = PropertyName::from_value(global_object, next_key); | ||||
|         auto property_name = PropertyKey::from_value(global_object, next_key); | ||||
| 
 | ||||
|         // a. Let propDesc be ? props.[[GetOwnProperty]](nextKey).
 | ||||
|         auto property_descriptor = TRY(props->internal_get_own_property(property_name)); | ||||
|  | @ -1237,7 +1237,7 @@ ThrowCompletionOr<Value> Object::ordinary_to_primitive(Value::PreferredType pref | |||
| 
 | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|     AK::Array<PropertyName, 2> method_names; | ||||
|     AK::Array<PropertyKey, 2> method_names; | ||||
| 
 | ||||
|     // 1. If hint is string, then
 | ||||
|     if (preferred_type == Value::PreferredType::String) { | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
| #include <LibJS/Runtime/PrimitiveString.h> | ||||
| #include <LibJS/Runtime/PrivateEnvironment.h> | ||||
| #include <LibJS/Runtime/PropertyDescriptor.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| #include <LibJS/Runtime/Shape.h> | ||||
| #include <LibJS/Runtime/Value.h> | ||||
| 
 | ||||
|  | @ -88,27 +88,27 @@ public: | |||
| 
 | ||||
|     // 7.3 Operations on Objects, https://tc39.es/ecma262/#sec-operations-on-objects
 | ||||
| 
 | ||||
|     ThrowCompletionOr<Value> get(PropertyName const&) const; | ||||
|     ThrowCompletionOr<bool> set(PropertyName const&, Value, ShouldThrowExceptions); | ||||
|     ThrowCompletionOr<bool> create_data_property(PropertyName const&, Value); | ||||
|     ThrowCompletionOr<bool> create_method_property(PropertyName const&, Value); | ||||
|     ThrowCompletionOr<bool> create_data_property_or_throw(PropertyName const&, Value); | ||||
|     ThrowCompletionOr<bool> create_non_enumerable_data_property_or_throw(PropertyName const&, Value); | ||||
|     ThrowCompletionOr<bool> define_property_or_throw(PropertyName const&, PropertyDescriptor const&); | ||||
|     ThrowCompletionOr<bool> delete_property_or_throw(PropertyName const&); | ||||
|     ThrowCompletionOr<bool> has_property(PropertyName const&) const; | ||||
|     ThrowCompletionOr<bool> has_own_property(PropertyName const&) const; | ||||
|     ThrowCompletionOr<Value> get(PropertyKey const&) const; | ||||
|     ThrowCompletionOr<bool> set(PropertyKey const&, Value, ShouldThrowExceptions); | ||||
|     ThrowCompletionOr<bool> create_data_property(PropertyKey const&, Value); | ||||
|     ThrowCompletionOr<bool> create_method_property(PropertyKey const&, Value); | ||||
|     ThrowCompletionOr<bool> create_data_property_or_throw(PropertyKey const&, Value); | ||||
|     ThrowCompletionOr<bool> create_non_enumerable_data_property_or_throw(PropertyKey const&, Value); | ||||
|     ThrowCompletionOr<bool> define_property_or_throw(PropertyKey const&, PropertyDescriptor const&); | ||||
|     ThrowCompletionOr<bool> delete_property_or_throw(PropertyKey const&); | ||||
|     ThrowCompletionOr<bool> has_property(PropertyKey const&) const; | ||||
|     ThrowCompletionOr<bool> has_own_property(PropertyKey const&) const; | ||||
|     ThrowCompletionOr<bool> set_integrity_level(IntegrityLevel); | ||||
|     ThrowCompletionOr<bool> test_integrity_level(IntegrityLevel) const; | ||||
|     ThrowCompletionOr<MarkedValueList> enumerable_own_property_names(PropertyKind kind) const; | ||||
|     ThrowCompletionOr<Object*> copy_data_properties(Value source, HashTable<PropertyName, PropertyNameTraits> const& seen_names, GlobalObject& global_object); | ||||
|     ThrowCompletionOr<Object*> copy_data_properties(Value source, HashTable<PropertyKey, PropertyNameTraits> const& seen_names, GlobalObject& global_object); | ||||
| 
 | ||||
|     PrivateElement* private_element_find(PrivateName const& name); | ||||
|     ThrowCompletionOr<void> private_field_add(PrivateName const& name, Value value); | ||||
|     ThrowCompletionOr<void> private_method_or_accessor_add(PrivateElement element); | ||||
|     ThrowCompletionOr<Value> private_get(PrivateName const& name); | ||||
|     ThrowCompletionOr<void> private_set(PrivateName const& name, Value value); | ||||
|     ThrowCompletionOr<void> define_field(Variant<PropertyName, PrivateName> name, ECMAScriptFunctionObject* initializer); | ||||
|     ThrowCompletionOr<void> define_field(Variant<PropertyKey, PrivateName> name, ECMAScriptFunctionObject* initializer); | ||||
| 
 | ||||
|     // 10.1 Ordinary Object Internal Methods and Internal Slots, https://tc39.es/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots
 | ||||
| 
 | ||||
|  | @ -116,15 +116,15 @@ public: | |||
|     virtual ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype); | ||||
|     virtual ThrowCompletionOr<bool> internal_is_extensible() const; | ||||
|     virtual ThrowCompletionOr<bool> internal_prevent_extensions(); | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyName const&) const; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyName const&, PropertyDescriptor const&); | ||||
|     virtual ThrowCompletionOr<bool> internal_has_property(PropertyName const&) const; | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyName const&, Value receiver) const; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyName const&, Value value, Value receiver); | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyName const&); | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&); | ||||
|     virtual ThrowCompletionOr<bool> internal_has_property(PropertyKey const&) const; | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver) const; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver); | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&); | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const; | ||||
| 
 | ||||
|     ThrowCompletionOr<bool> ordinary_set_with_own_descriptor(PropertyName const&, Value, Value, Optional<PropertyDescriptor>); | ||||
|     ThrowCompletionOr<bool> ordinary_set_with_own_descriptor(PropertyKey const&, Value, Value, Optional<PropertyDescriptor>); | ||||
| 
 | ||||
|     // 10.4.7 Immutable Prototype Exotic Objects, https://tc39.es/ecma262/#sec-immutable-prototype-exotic-objects
 | ||||
| 
 | ||||
|  | @ -136,24 +136,24 @@ public: | |||
| 
 | ||||
|     // Implementation-specific storage abstractions
 | ||||
| 
 | ||||
|     Optional<ValueAndAttributes> storage_get(PropertyName const&) const; | ||||
|     bool storage_has(PropertyName const&) const; | ||||
|     void storage_set(PropertyName const&, ValueAndAttributes const&); | ||||
|     void storage_delete(PropertyName const&); | ||||
|     Optional<ValueAndAttributes> storage_get(PropertyKey const&) const; | ||||
|     bool storage_has(PropertyKey const&) const; | ||||
|     void storage_set(PropertyKey const&, ValueAndAttributes const&); | ||||
|     void storage_delete(PropertyKey const&); | ||||
| 
 | ||||
|     // Non-standard methods
 | ||||
| 
 | ||||
|     Value get_without_side_effects(const PropertyName&) const; | ||||
|     Value get_without_side_effects(const PropertyKey&) const; | ||||
| 
 | ||||
|     void define_direct_property(PropertyName const& property_name, Value value, PropertyAttributes attributes) { storage_set(property_name, { value, attributes }); }; | ||||
|     void define_direct_accessor(PropertyName const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes); | ||||
|     void define_direct_property(PropertyKey const& property_name, Value value, PropertyAttributes attributes) { storage_set(property_name, { value, attributes }); }; | ||||
|     void define_direct_accessor(PropertyKey const&, FunctionObject* getter, FunctionObject* setter, PropertyAttributes attributes); | ||||
| 
 | ||||
|     // Legacy methods - Remove once JS_DECLARE_OLD_NATIVE_FUNCTION is removed
 | ||||
|     void define_old_native_function(PropertyName const&, Function<Value(VM&, GlobalObject&)>, i32 length, PropertyAttributes attributes); | ||||
|     void define_old_native_accessor(PropertyName const&, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attributes); | ||||
|     void define_old_native_function(PropertyKey const&, Function<Value(VM&, GlobalObject&)>, i32 length, PropertyAttributes attributes); | ||||
|     void define_old_native_accessor(PropertyKey const&, Function<Value(VM&, GlobalObject&)> getter, Function<Value(VM&, GlobalObject&)> setter, PropertyAttributes attributes); | ||||
| 
 | ||||
|     void define_native_function(PropertyName const&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>, i32 length, PropertyAttributes attributes); | ||||
|     void define_native_accessor(PropertyName const&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> getter, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> setter, PropertyAttributes attributes); | ||||
|     void define_native_function(PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)>, i32 length, PropertyAttributes attributes); | ||||
|     void define_native_accessor(PropertyKey const&, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> getter, Function<ThrowCompletionOr<Value>(VM&, GlobalObject&)> setter, PropertyAttributes attributes); | ||||
| 
 | ||||
|     virtual bool is_function() const { return false; } | ||||
|     virtual bool is_typed_array() const { return false; } | ||||
|  |  | |||
|  | @ -285,7 +285,7 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptors) | |||
| 
 | ||||
|     // 4. For each element key of ownKeys, do
 | ||||
|     for (auto& key : own_keys) { | ||||
|         auto property_name = PropertyName::from_value(global_object, key); | ||||
|         auto property_name = PropertyKey::from_value(global_object, key); | ||||
| 
 | ||||
|         // a. Let desc be ? obj.[[GetOwnProperty]](key).
 | ||||
|         auto desc = TRY_OR_DISCARD(object->internal_get_own_property(property_name)); | ||||
|  | @ -425,7 +425,7 @@ JS_DEFINE_OLD_NATIVE_FUNCTION(ObjectConstructor::assign) | |||
| 
 | ||||
|         // iii. For each element nextKey of keys, do
 | ||||
|         for (auto& next_key : keys) { | ||||
|             auto property_name = PropertyName::from_value(global_object, next_key); | ||||
|             auto property_name = PropertyKey::from_value(global_object, next_key); | ||||
| 
 | ||||
|             // 1. Let desc be ? from.[[GetOwnProperty]](nextKey).
 | ||||
|             auto desc = TRY_OR_DISCARD(from->internal_get_own_property(property_name)); | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| class PropertyName { | ||||
| class PropertyKey { | ||||
| public: | ||||
|     enum class Type : u8 { | ||||
|         Invalid, | ||||
|  | @ -26,7 +26,7 @@ public: | |||
|         No, | ||||
|     }; | ||||
| 
 | ||||
|     static PropertyName from_value(GlobalObject& global_object, Value value) | ||||
|     static PropertyKey from_value(GlobalObject& global_object, Value value) | ||||
|     { | ||||
|         if (value.is_empty()) | ||||
|             return {}; | ||||
|  | @ -37,10 +37,10 @@ public: | |||
|         return TRY_OR_DISCARD(value.to_string(global_object)); | ||||
|     } | ||||
| 
 | ||||
|     PropertyName() { } | ||||
|     PropertyKey() { } | ||||
| 
 | ||||
|     template<Integral T> | ||||
|     PropertyName(T index) | ||||
|     PropertyKey(T index) | ||||
|     { | ||||
|         // FIXME: Replace this with requires(IsUnsigned<T>)?
 | ||||
|         //        Needs changes in various places using `int` (but not actually being in the negative range)
 | ||||
|  | @ -58,20 +58,20 @@ public: | |||
|         m_number = index; | ||||
|     } | ||||
| 
 | ||||
|     PropertyName(char const* chars) | ||||
|     PropertyKey(char const* chars) | ||||
|         : m_type(Type::String) | ||||
|         , m_string(FlyString(chars)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     PropertyName(String const& string) | ||||
|     PropertyKey(String const& string) | ||||
|         : m_type(Type::String) | ||||
|         , m_string(FlyString(string)) | ||||
|     { | ||||
|         VERIFY(!m_string.is_null()); | ||||
|     } | ||||
| 
 | ||||
|     PropertyName(FlyString string, StringMayBeNumber string_may_be_number = StringMayBeNumber::Yes) | ||||
|     PropertyKey(FlyString string, StringMayBeNumber string_may_be_number = StringMayBeNumber::Yes) | ||||
|         : m_string_may_be_number(string_may_be_number == StringMayBeNumber::Yes) | ||||
|         , m_type(Type::String) | ||||
|         , m_string(move(string)) | ||||
|  | @ -79,13 +79,13 @@ public: | |||
|         VERIFY(!m_string.is_null()); | ||||
|     } | ||||
| 
 | ||||
|     PropertyName(Symbol& symbol) | ||||
|     PropertyKey(Symbol& symbol) | ||||
|         : m_type(Type::Symbol) | ||||
|         , m_symbol(&symbol) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     PropertyName(StringOrSymbol const& string_or_symbol) | ||||
|     PropertyKey(StringOrSymbol const& string_or_symbol) | ||||
|     { | ||||
|         if (string_or_symbol.is_string()) { | ||||
|             m_string = string_or_symbol.as_string(); | ||||
|  | @ -106,7 +106,7 @@ public: | |||
|         if (m_type != Type::String || !m_string_may_be_number) | ||||
|             return false; | ||||
| 
 | ||||
|         return const_cast<PropertyName*>(this)->try_coerce_into_number(); | ||||
|         return const_cast<PropertyKey*>(this)->try_coerce_into_number(); | ||||
|     } | ||||
|     bool is_string() const | ||||
|     { | ||||
|  | @ -115,7 +115,7 @@ public: | |||
|         if (!m_string_may_be_number) | ||||
|             return true; | ||||
| 
 | ||||
|         return !const_cast<PropertyName*>(this)->try_coerce_into_number(); | ||||
|         return !const_cast<PropertyKey*>(this)->try_coerce_into_number(); | ||||
|     } | ||||
|     bool is_symbol() const { return m_type == Type::Symbol; } | ||||
| 
 | ||||
|  | @ -189,8 +189,8 @@ private: | |||
|     Symbol* m_symbol { nullptr }; | ||||
| }; | ||||
| 
 | ||||
| struct PropertyNameTraits : public Traits<PropertyName> { | ||||
|     static unsigned hash(PropertyName const& name) | ||||
| struct PropertyNameTraits : public Traits<PropertyKey> { | ||||
|     static unsigned hash(PropertyKey const& name) | ||||
|     { | ||||
|         VERIFY(name.is_valid()); | ||||
|         if (name.is_string()) | ||||
|  | @ -200,17 +200,17 @@ struct PropertyNameTraits : public Traits<PropertyName> { | |||
|         return ptr_hash(name.as_symbol()); | ||||
|     } | ||||
| 
 | ||||
|     static bool equals(PropertyName const& a, PropertyName const& b) | ||||
|     static bool equals(PropertyKey const& a, PropertyKey const& b) | ||||
|     { | ||||
|         if (a.type() != b.type()) | ||||
|             return false; | ||||
| 
 | ||||
|         switch (a.type()) { | ||||
|         case PropertyName::Type::Number: | ||||
|         case PropertyKey::Type::Number: | ||||
|             return a.as_number() == b.as_number(); | ||||
|         case PropertyName::Type::String: | ||||
|         case PropertyKey::Type::String: | ||||
|             return a.as_string() == b.as_string(); | ||||
|         case PropertyName::Type::Symbol: | ||||
|         case PropertyKey::Type::Symbol: | ||||
|             return a.as_symbol() == b.as_symbol(); | ||||
|         default: | ||||
|             VERIFY_NOT_REACHED(); | ||||
|  | @ -223,11 +223,11 @@ struct PropertyNameTraits : public Traits<PropertyName> { | |||
| namespace AK { | ||||
| 
 | ||||
| template<> | ||||
| struct Formatter<JS::PropertyName> : Formatter<StringView> { | ||||
|     void format(FormatBuilder& builder, JS::PropertyName const& property_name) | ||||
| struct Formatter<JS::PropertyKey> : Formatter<StringView> { | ||||
|     void format(FormatBuilder& builder, JS::PropertyKey const& property_name) | ||||
|     { | ||||
|         if (!property_name.is_valid()) | ||||
|             Formatter<StringView>::format(builder, "<invalid PropertyName>"); | ||||
|             Formatter<StringView>::format(builder, "<invalid PropertyKey>"); | ||||
|         else if (property_name.is_number()) | ||||
|             Formatter<StringView>::format(builder, String::number(property_name.as_number())); | ||||
|         else | ||||
|  | @ -31,7 +31,7 @@ ProxyObject::~ProxyObject() | |||
| { | ||||
| } | ||||
| 
 | ||||
| static Value property_name_to_value(VM& vm, PropertyName const& name) | ||||
| static Value property_name_to_value(VM& vm, PropertyKey const& name) | ||||
| { | ||||
|     VERIFY(name.is_valid()); | ||||
|     if (name.is_symbol()) | ||||
|  | @ -223,7 +223,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_prevent_extensions() | |||
| } | ||||
| 
 | ||||
| // 10.5.5 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p
 | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> ProxyObject::internal_get_own_property(const PropertyName& property_name) const | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> ProxyObject::internal_get_own_property(const PropertyKey& property_name) const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -316,7 +316,7 @@ ThrowCompletionOr<Optional<PropertyDescriptor>> ProxyObject::internal_get_own_pr | |||
| } | ||||
| 
 | ||||
| // 10.5.6 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc
 | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_define_own_property(PropertyName const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -400,7 +400,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_define_own_property(PropertyName c | |||
| } | ||||
| 
 | ||||
| // 10.5.7 [[HasProperty]] ( P ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p
 | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_has_property(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_has_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -454,7 +454,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_has_property(PropertyName const& p | |||
| } | ||||
| 
 | ||||
| // 10.5.8 [[Get]] ( P, Receiver ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver
 | ||||
| ThrowCompletionOr<Value> ProxyObject::internal_get(PropertyName const& property_name, Value receiver) const | ||||
| ThrowCompletionOr<Value> ProxyObject::internal_get(PropertyKey const& property_name, Value receiver) const | ||||
| { | ||||
|     VERIFY(!receiver.is_empty()); | ||||
| 
 | ||||
|  | @ -525,7 +525,7 @@ ThrowCompletionOr<Value> ProxyObject::internal_get(PropertyName const& property_ | |||
| } | ||||
| 
 | ||||
| // 10.5.9 [[Set]] ( P, V, Receiver ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver
 | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_set(PropertyName const& property_name, Value value, Value receiver) | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_set(PropertyKey const& property_name, Value value, Value receiver) | ||||
| { | ||||
|     VERIFY(!value.is_empty()); | ||||
|     VERIFY(!receiver.is_empty()); | ||||
|  | @ -585,7 +585,7 @@ ThrowCompletionOr<bool> ProxyObject::internal_set(PropertyName const& property_n | |||
| } | ||||
| 
 | ||||
| // 10.5.10 [[Delete]] ( P ), https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-delete-p
 | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_delete(PropertyName const& property_name) | ||||
| ThrowCompletionOr<bool> ProxyObject::internal_delete(PropertyKey const& property_name) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
|     auto& global_object = this->global_object(); | ||||
|  | @ -700,7 +700,7 @@ ThrowCompletionOr<MarkedValueList> ProxyObject::internal_own_property_keys() con | |||
|     // 16. For each element key of targetKeys, do
 | ||||
|     for (auto& key : target_keys) { | ||||
|         // a. Let desc be ? target.[[GetOwnProperty]](key).
 | ||||
|         auto descriptor = TRY(m_target.internal_get_own_property(PropertyName::from_value(global_object, key))); | ||||
|         auto descriptor = TRY(m_target.internal_get_own_property(PropertyKey::from_value(global_object, key))); | ||||
| 
 | ||||
|         // b. If desc is not undefined and desc.[[Configurable]] is false, then
 | ||||
|         if (descriptor.has_value() && !*descriptor->configurable) { | ||||
|  |  | |||
|  | @ -36,12 +36,12 @@ public: | |||
|     virtual ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_is_extensible() const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_prevent_extensions() override; | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyName const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyName const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_has_property(PropertyName const&) const override; | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyName const&, Value receiver) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyName const&, Value value, Value receiver) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyName const&) override; | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_has_property(PropertyKey const&) const override; | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyKey const&, Value receiver) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver) override; | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override; | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override; | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedValueList arguments_list) override; | ||||
|     virtual ThrowCompletionOr<Object*> internal_construct(MarkedValueList arguments_list, FunctionObject& new_target) override; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| #include <LibJS/Runtime/Environment.h> | ||||
| #include <LibJS/Runtime/EnvironmentCoordinate.h> | ||||
| #include <LibJS/Runtime/ExecutionContext.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| #include <LibJS/Runtime/Value.h> | ||||
| 
 | ||||
| namespace JS { | ||||
|  | @ -26,14 +26,14 @@ public: | |||
|     }; | ||||
| 
 | ||||
|     Reference() { } | ||||
|     Reference(BaseType type, PropertyName name, bool strict) | ||||
|     Reference(BaseType type, PropertyKey name, bool strict) | ||||
|         : m_base_type(type) | ||||
|         , m_name(move(name)) | ||||
|         , m_strict(strict) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     Reference(Value base, PropertyName name, Value this_value, bool strict = false) | ||||
|     Reference(Value base, PropertyKey name, Value this_value, bool strict = false) | ||||
|         : m_base_type(BaseType::Value) | ||||
|         , m_base_value(base) | ||||
|         , m_name(move(name)) | ||||
|  | @ -79,7 +79,7 @@ public: | |||
|         return *m_base_environment; | ||||
|     } | ||||
| 
 | ||||
|     PropertyName const& name() const { return m_name; } | ||||
|     PropertyKey const& name() const { return m_name; } | ||||
|     bool is_strict() const { return m_strict; } | ||||
| 
 | ||||
|     // 6.2.4.2 IsUnresolvableReference ( V ), https://tc39.es/ecma262/#sec-isunresolvablereference
 | ||||
|  | @ -147,7 +147,7 @@ private: | |||
|         Value m_base_value {}; | ||||
|         mutable Environment* m_base_environment; | ||||
|     }; | ||||
|     PropertyName m_name; | ||||
|     PropertyKey m_name; | ||||
|     Value m_this_value; | ||||
|     bool m_strict { false }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -232,7 +232,7 @@ void Shape::add_property_without_transition(StringOrSymbol const& property_name, | |||
|         ++m_property_count; | ||||
| } | ||||
| 
 | ||||
| FLATTEN void Shape::add_property_without_transition(PropertyName const& property_name, PropertyAttributes attributes) | ||||
| FLATTEN void Shape::add_property_without_transition(PropertyKey const& property_name, PropertyAttributes attributes) | ||||
| { | ||||
|     VERIFY(property_name.is_valid()); | ||||
|     add_property_without_transition(property_name.to_string_or_symbol(), attributes); | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ public: | |||
|     Shape* create_prototype_transition(Object* new_prototype); | ||||
| 
 | ||||
|     void add_property_without_transition(const StringOrSymbol&, PropertyAttributes); | ||||
|     void add_property_without_transition(PropertyName const&, PropertyAttributes); | ||||
|     void add_property_without_transition(PropertyKey const&, PropertyAttributes); | ||||
| 
 | ||||
|     bool is_unique() const { return m_unique; } | ||||
|     Shape* create_unique_clone() const; | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ 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, PropertyName const& property_name) | ||||
| static Optional<PropertyDescriptor> string_get_own_property(GlobalObject& global_object, StringObject const& string, PropertyKey const& property_name) | ||||
| { | ||||
|     // 1. Assert: S is an Object that has a [[StringData]] internal slot.
 | ||||
|     // 2. Assert: IsPropertyKey(P) is true.
 | ||||
|  | @ -52,7 +52,7 @@ static Optional<PropertyDescriptor> string_get_own_property(GlobalObject& global | |||
| 
 | ||||
|     // 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 PropertyName, so '!property_name.is_string()' would be wrong.
 | ||||
|     // this is not the case for PropertyKey, so '!property_name.is_string()' would be wrong.
 | ||||
|     if (property_name.is_symbol()) | ||||
|         return {}; | ||||
| 
 | ||||
|  | @ -92,7 +92,7 @@ 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(PropertyName const& property_name) const | ||||
| ThrowCompletionOr<Optional<PropertyDescriptor>> StringObject::internal_get_own_property(PropertyKey const& property_name) const | ||||
| { | ||||
|     // Assert: IsPropertyKey(P) is true.
 | ||||
| 
 | ||||
|  | @ -108,7 +108,7 @@ ThrowCompletionOr<Optional<PropertyDescriptor>> StringObject::internal_get_own_p | |||
| } | ||||
| 
 | ||||
| // 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(PropertyName const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| ThrowCompletionOr<bool> StringObject::internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& property_descriptor) | ||||
| { | ||||
|     // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|     VERIFY(property_name.is_valid()); | ||||
|  |  | |||
|  | @ -29,8 +29,8 @@ public: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyName const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyName const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override; | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&) override; | ||||
|     virtual ThrowCompletionOr<MarkedValueList> internal_own_property_keys() const override; | ||||
| 
 | ||||
|     virtual bool is_string_object() const final { return true; } | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
| #include <AK/Variant.h> | ||||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/IteratorOperations.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| #include <LibJS/Runtime/Temporal/AbstractOperations.h> | ||||
| #include <LibJS/Runtime/Temporal/Calendar.h> | ||||
| #include <LibJS/Runtime/Temporal/Duration.h> | ||||
|  | @ -96,7 +96,7 @@ ThrowCompletionOr<Object*> get_options_object(GlobalObject& global_object, Value | |||
| } | ||||
| 
 | ||||
| // 13.3 GetOption ( options, property, types, values, fallback ), https://tc39.es/proposal-temporal/#sec-getoption
 | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& options, PropertyName const& property, Vector<OptionType> const& types, Vector<StringView> const& values, Value fallback) | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, Vector<OptionType> const& types, Vector<StringView> const& values, Value fallback) | ||||
| { | ||||
|     VERIFY(property.is_string()); | ||||
| 
 | ||||
|  | @ -158,7 +158,7 @@ ThrowCompletionOr<Value> get_option(GlobalObject& global_object, Object const& o | |||
| 
 | ||||
| // 13.4 GetStringOrNumberOption ( options, property, stringValues, minimum, maximum, fallback ), https://tc39.es/proposal-temporal/#sec-getstringornumberoption
 | ||||
| template<typename NumberType> | ||||
| ThrowCompletionOr<Variant<String, NumberType>> get_string_or_number_option(GlobalObject& global_object, Object const& options, PropertyName const& property, Vector<StringView> const& string_values, NumberType minimum, NumberType maximum, Value fallback) | ||||
| ThrowCompletionOr<Variant<String, NumberType>> get_string_or_number_option(GlobalObject& global_object, Object const& options, PropertyKey const& property, Vector<StringView> const& string_values, NumberType minimum, NumberType maximum, Value fallback) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -86,9 +86,9 @@ struct SecondsStringPrecision { | |||
| 
 | ||||
| ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject&, Value items, Vector<OptionType> const& element_types); | ||||
| ThrowCompletionOr<Object*> get_options_object(GlobalObject&, Value options); | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject&, Object const& options, PropertyName const& property, Vector<OptionType> const& types, Vector<StringView> const& values, Value fallback); | ||||
| ThrowCompletionOr<Value> get_option(GlobalObject&, Object const& options, PropertyKey const& property, Vector<OptionType> const& types, Vector<StringView> const& values, Value fallback); | ||||
| template<typename NumberType> | ||||
| ThrowCompletionOr<Variant<String, NumberType>> get_string_or_number_option(GlobalObject&, Object const& options, PropertyName const& property, Vector<StringView> const& string_values, NumberType minimum, NumberType maximum, Value fallback); | ||||
| ThrowCompletionOr<Variant<String, NumberType>> get_string_or_number_option(GlobalObject&, Object const& options, PropertyKey const& property, Vector<StringView> const& string_values, NumberType minimum, NumberType maximum, Value fallback); | ||||
| ThrowCompletionOr<String> to_temporal_overflow(GlobalObject&, Object const& normalized_options); | ||||
| ThrowCompletionOr<String> to_temporal_rounding_mode(GlobalObject&, Object const& normalized_options, String const& fallback); | ||||
| ThrowCompletionOr<String> to_show_calendar_option(GlobalObject&, Object const& normalized_options); | ||||
|  |  | |||
|  | @ -939,7 +939,7 @@ ThrowCompletionOr<Object*> default_merge_fields(GlobalObject& global_object, Obj | |||
|     for (auto& next_key : original_keys) { | ||||
|         // a. If nextKey is not "month" or "monthCode", then
 | ||||
|         if (next_key.as_string().string() != vm.names.month.as_string() && next_key.as_string().string() != vm.names.monthCode.as_string()) { | ||||
|             auto property_name = PropertyName::from_value(global_object, next_key); | ||||
|             auto property_name = PropertyKey::from_value(global_object, next_key); | ||||
| 
 | ||||
|             // i. Let propValue be ? Get(fields, nextKey).
 | ||||
|             auto prop_value = TRY(fields.get(property_name)); | ||||
|  | @ -960,7 +960,7 @@ ThrowCompletionOr<Object*> default_merge_fields(GlobalObject& global_object, Obj | |||
| 
 | ||||
|     // 5. For each element nextKey of newKeys, do
 | ||||
|     for (auto& next_key : new_keys) { | ||||
|         auto property_name = PropertyName::from_value(global_object, next_key); | ||||
|         auto property_name = PropertyKey::from_value(global_object, next_key); | ||||
| 
 | ||||
|         // a. Let propValue be ? Get(additionalFields, nextKey).
 | ||||
|         auto prop_value = TRY(additional_fields.get(property_name)); | ||||
|  |  | |||
|  | @ -89,7 +89,7 @@ struct BalancedDuration { | |||
| template<typename StructT, typename ValueT> | ||||
| struct TemporalDurationLikeProperty { | ||||
|     ValueT StructT::*internal_slot { nullptr }; | ||||
|     PropertyName property; | ||||
|     PropertyKey property; | ||||
| }; | ||||
| 
 | ||||
| template<typename StructT, typename ValueT> | ||||
|  |  | |||
|  | @ -76,7 +76,7 @@ struct PartialUnregulatedTemporalTime { | |||
| template<typename StructT, typename ValueT> | ||||
| struct TemporalTimeLikeProperty { | ||||
|     ValueT StructT::*internal_slot { nullptr }; | ||||
|     PropertyName property; | ||||
|     PropertyKey property; | ||||
| }; | ||||
| 
 | ||||
| template<typename StructT, typename ValueT> | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/GlobalObject.h> | ||||
| #include <LibJS/Runtime/PropertyDescriptor.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| #include <LibJS/Runtime/TypedArrayConstructor.h> | ||||
| #include <LibJS/Runtime/VM.h> | ||||
| 
 | ||||
|  | @ -80,7 +80,7 @@ inline bool is_valid_integer_index(TypedArrayBase const& typed_array, Value prop | |||
|         return false; | ||||
| 
 | ||||
|     // TODO: This can be optimized by skipping the following 3 out of 4 checks if property_index
 | ||||
|     //  came from a number-type PropertyName instead of a canonicalized string-type PropertyName
 | ||||
|     //  came from a number-type PropertyKey instead of a canonicalized string-type PropertyKey
 | ||||
| 
 | ||||
|     // If ! IsIntegralNumber(index) is false, return false.
 | ||||
|     if (!property_index.is_integral_number()) | ||||
|  | @ -190,7 +190,7 @@ class TypedArray : public TypedArrayBase { | |||
| 
 | ||||
| public: | ||||
|     // 10.4.5.1 [[GetOwnProperty]] ( P ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-getownproperty-p
 | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyName const& property_name) const override | ||||
|     virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const& property_name) const override | ||||
|     { | ||||
|         // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|         VERIFY(property_name.is_valid()); | ||||
|  | @ -230,7 +230,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     // 10.4.5.2 [[HasProperty]] ( P ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-hasproperty-p
 | ||||
|     virtual ThrowCompletionOr<bool> internal_has_property(PropertyName const& property_name) const override | ||||
|     virtual ThrowCompletionOr<bool> internal_has_property(PropertyKey const& property_name) const override | ||||
|     { | ||||
|         // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|         VERIFY(property_name.is_valid()); | ||||
|  | @ -256,7 +256,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     // 10.4.5.3 [[DefineOwnProperty]] ( P, Desc ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-defineownproperty-p-desc
 | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyName const& property_name, PropertyDescriptor const& property_descriptor) override | ||||
|     virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const& property_name, PropertyDescriptor const& property_descriptor) override | ||||
|     { | ||||
|         // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|         VERIFY(property_name.is_valid()); | ||||
|  | @ -311,7 +311,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     // 10.4.5.4 [[Get]] ( P, Receiver ), 10.4.5.4 [[Get]] ( P, Receiver )
 | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyName const& property_name, Value receiver) const override | ||||
|     virtual ThrowCompletionOr<Value> internal_get(PropertyKey const& property_name, Value receiver) const override | ||||
|     { | ||||
|         VERIFY(!receiver.is_empty()); | ||||
| 
 | ||||
|  | @ -338,7 +338,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     // 10.4.5.5 [[Set]] ( P, V, Receiver ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-set-p-v-receiver
 | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyName const& property_name, Value value, Value receiver) override | ||||
|     virtual ThrowCompletionOr<bool> internal_set(PropertyKey const& property_name, Value value, Value receiver) override | ||||
|     { | ||||
|         VERIFY(!value.is_empty()); | ||||
|         VERIFY(!receiver.is_empty()); | ||||
|  | @ -371,7 +371,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     // 10.4.5.6 [[Delete]] ( P ), https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects-delete-p
 | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyName const& property_name) override | ||||
|     virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const& property_name) override | ||||
|     { | ||||
|         // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|         VERIFY(property_name.is_valid()); | ||||
|  |  | |||
|  | @ -219,7 +219,7 @@ ThrowCompletionOr<void> VM::property_binding_initialization(BindingPattern const | |||
| { | ||||
|     auto* object = TRY(value.to_object(global_object)); | ||||
| 
 | ||||
|     HashTable<PropertyName, PropertyNameTraits> seen_names; | ||||
|     HashTable<PropertyKey, PropertyNameTraits> seen_names; | ||||
|     for (auto& property : binding.entries) { | ||||
| 
 | ||||
|         VERIFY(!property.is_elision()); | ||||
|  | @ -249,7 +249,7 @@ ThrowCompletionOr<void> VM::property_binding_initialization(BindingPattern const | |||
|             break; | ||||
|         } | ||||
| 
 | ||||
|         PropertyName name; | ||||
|         PropertyKey name; | ||||
| 
 | ||||
|         property.name.visit( | ||||
|             [&](Empty) { VERIFY_NOT_REACHED(); }, | ||||
|  |  | |||
|  | @ -279,7 +279,7 @@ private: | |||
| 
 | ||||
|     [[nodiscard]] ThrowCompletionOr<Value> call_internal(FunctionObject&, Value this_value, Optional<MarkedValueList> arguments); | ||||
| 
 | ||||
|     ThrowCompletionOr<Object*> copy_data_properties(Object& rest_object, Object const& source, HashTable<PropertyName, PropertyNameTraits> const& seen_names, GlobalObject& global_object); | ||||
|     ThrowCompletionOr<Object*> copy_data_properties(Object& rest_object, Object const& source, HashTable<PropertyKey, PropertyNameTraits> const& seen_names, GlobalObject& global_object); | ||||
| 
 | ||||
|     ThrowCompletionOr<void> property_binding_initialization(BindingPattern const& binding, Value value, Environment* environment, GlobalObject& global_object); | ||||
|     ThrowCompletionOr<void> iterator_binding_initialization(BindingPattern const& binding, Object* iterator, bool& iterator_done, Environment* environment, GlobalObject& global_object); | ||||
|  |  | |||
|  | @ -733,7 +733,7 @@ ThrowCompletionOr<double> Value::to_integer_or_infinity(GlobalObject& global_obj | |||
| } | ||||
| 
 | ||||
| // 7.3.3 GetV ( V, P ), https://tc39.es/ecma262/#sec-getv
 | ||||
| ThrowCompletionOr<Value> Value::get(GlobalObject& global_object, PropertyName const& property_name) const | ||||
| ThrowCompletionOr<Value> Value::get(GlobalObject& global_object, PropertyKey const& property_name) const | ||||
| { | ||||
|     // 1. Assert: IsPropertyKey(P) is true.
 | ||||
|     VERIFY(property_name.is_valid()); | ||||
|  | @ -746,7 +746,7 @@ ThrowCompletionOr<Value> Value::get(GlobalObject& global_object, PropertyName co | |||
| } | ||||
| 
 | ||||
| // 7.3.10 GetMethod ( V, P ), https://tc39.es/ecma262/#sec-getmethod
 | ||||
| ThrowCompletionOr<FunctionObject*> Value::get_method(GlobalObject& global_object, PropertyName const& property_name) const | ||||
| ThrowCompletionOr<FunctionObject*> Value::get_method(GlobalObject& global_object, PropertyKey const& property_name) const | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
| 
 | ||||
|  | @ -1455,7 +1455,7 @@ ThrowCompletionOr<TriState> is_less_than(GlobalObject& global_object, bool left_ | |||
| } | ||||
| 
 | ||||
| // 7.3.20 Invoke ( V, P [ , argumentsList ] ), https://tc39.es/ecma262/#sec-invoke
 | ||||
| ThrowCompletionOr<Value> Value::invoke_internal(GlobalObject& global_object, JS::PropertyName const& property_name, Optional<MarkedValueList> arguments) | ||||
| ThrowCompletionOr<Value> Value::invoke_internal(GlobalObject& global_object, JS::PropertyKey const& property_name, Optional<MarkedValueList> arguments) | ||||
| { | ||||
|     auto& vm = global_object.vm(); | ||||
|     auto property = TRY(get(global_object, property_name)); | ||||
|  |  | |||
|  | @ -327,8 +327,8 @@ public: | |||
|     ThrowCompletionOr<double> to_integer_or_infinity(GlobalObject&) const; | ||||
|     bool to_boolean() const; | ||||
| 
 | ||||
|     ThrowCompletionOr<Value> get(GlobalObject&, PropertyName const&) const; | ||||
|     ThrowCompletionOr<FunctionObject*> get_method(GlobalObject&, PropertyName const&) const; | ||||
|     ThrowCompletionOr<Value> get(GlobalObject&, PropertyKey const&) const; | ||||
|     ThrowCompletionOr<FunctionObject*> get_method(GlobalObject&, PropertyKey const&) const; | ||||
| 
 | ||||
|     String to_string_without_side_effects() const; | ||||
| 
 | ||||
|  | @ -344,12 +344,12 @@ public: | |||
|     bool operator==(Value const&) const; | ||||
| 
 | ||||
|     template<typename... Args> | ||||
|     [[nodiscard]] ALWAYS_INLINE ThrowCompletionOr<Value> invoke(GlobalObject& global_object, PropertyName const& property_name, Args... args); | ||||
|     [[nodiscard]] ALWAYS_INLINE ThrowCompletionOr<Value> invoke(GlobalObject& global_object, PropertyKey const& property_name, Args... args); | ||||
| 
 | ||||
| private: | ||||
|     Type m_type { Type::Empty }; | ||||
| 
 | ||||
|     [[nodiscard]] ThrowCompletionOr<Value> invoke_internal(GlobalObject& global_object, PropertyName const&, Optional<MarkedValueList> arguments); | ||||
|     [[nodiscard]] ThrowCompletionOr<Value> invoke_internal(GlobalObject& global_object, PropertyKey const&, Optional<MarkedValueList> arguments); | ||||
| 
 | ||||
|     ThrowCompletionOr<i32> to_i32_slow_case(GlobalObject&) const; | ||||
| 
 | ||||
|  |  | |||
|  | @ -21,14 +21,14 @@ static CSS::PropertyID property_id_from_name(StringView name) | |||
|     return CSS::PropertyID::Invalid; | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> CSSStyleDeclarationWrapper::internal_has_property(JS::PropertyName const& name) const | ||||
| JS::ThrowCompletionOr<bool> CSSStyleDeclarationWrapper::internal_has_property(JS::PropertyKey const& name) const | ||||
| { | ||||
|     if (!name.is_string()) | ||||
|         return Base::internal_has_property(name); | ||||
|     return property_id_from_name(name.to_string()) != CSS::PropertyID::Invalid; | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<JS::Value> CSSStyleDeclarationWrapper::internal_get(JS::PropertyName const& name, JS::Value receiver) const | ||||
| JS::ThrowCompletionOr<JS::Value> CSSStyleDeclarationWrapper::internal_get(JS::PropertyKey const& name, JS::Value receiver) const | ||||
| { | ||||
|     if (!name.is_string()) | ||||
|         return Base::internal_get(name, receiver); | ||||
|  | @ -40,7 +40,7 @@ JS::ThrowCompletionOr<JS::Value> CSSStyleDeclarationWrapper::internal_get(JS::Pr | |||
|     return { js_string(vm(), String::empty()) }; | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> CSSStyleDeclarationWrapper::internal_set(JS::PropertyName const& name, JS::Value value, JS::Value receiver) | ||||
| JS::ThrowCompletionOr<bool> CSSStyleDeclarationWrapper::internal_set(JS::PropertyKey const& name, JS::Value value, JS::Value receiver) | ||||
| { | ||||
|     if (!name.is_string()) | ||||
|         return Base::internal_set(name, value, receiver); | ||||
|  |  | |||
|  | @ -6,13 +6,13 @@ | |||
| 
 | ||||
| #include <AK/NumericLimits.h> | ||||
| #include <LibJS/Runtime/AbstractOperations.h> | ||||
| #include <LibJS/Runtime/PropertyName.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| #include <LibWeb/Bindings/IDLAbstractOperations.h> | ||||
| 
 | ||||
| namespace Web::Bindings::IDL { | ||||
| 
 | ||||
| // https://webidl.spec.whatwg.org/#is-an-array-index
 | ||||
| bool is_an_array_index(JS::GlobalObject& global_object, JS::PropertyName const& property_name) | ||||
| bool is_an_array_index(JS::GlobalObject& global_object, JS::PropertyKey const& property_name) | ||||
| { | ||||
|     // 1. If Type(P) is not String, then return false.
 | ||||
|     if (!property_name.is_number()) | ||||
|  |  | |||
|  | @ -10,6 +10,6 @@ | |||
| 
 | ||||
| namespace Web::Bindings::IDL { | ||||
| 
 | ||||
| bool is_an_array_index(JS::GlobalObject&, JS::PropertyName const&); | ||||
| bool is_an_array_index(JS::GlobalObject&, JS::PropertyKey const&); | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -57,7 +57,7 @@ JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_prevent_extensions() | |||
|     return m_window_object->internal_prevent_extensions(); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> ConsoleGlobalObject::internal_get_own_property(JS::PropertyName const& property_name) const | ||||
| JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> ConsoleGlobalObject::internal_get_own_property(JS::PropertyKey const& property_name) const | ||||
| { | ||||
|     if (auto result = TRY(m_window_object->internal_get_own_property(property_name)); result.has_value()) | ||||
|         return result; | ||||
|  | @ -65,17 +65,17 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> ConsoleGlobalObject::int | |||
|     return Base::internal_get_own_property(property_name); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_define_own_property(JS::PropertyName const& property_name, JS::PropertyDescriptor const& descriptor) | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_define_own_property(JS::PropertyKey const& property_name, JS::PropertyDescriptor const& descriptor) | ||||
| { | ||||
|     return m_window_object->internal_define_own_property(property_name, descriptor); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_has_property(JS::PropertyName const& property_name) const | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_has_property(JS::PropertyKey const& property_name) const | ||||
| { | ||||
|     return TRY(Object::internal_has_property(property_name)) || TRY(m_window_object->internal_has_property(property_name)); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<JS::Value> ConsoleGlobalObject::internal_get(JS::PropertyName const& property_name, JS::Value receiver) const | ||||
| JS::ThrowCompletionOr<JS::Value> ConsoleGlobalObject::internal_get(JS::PropertyKey const& property_name, JS::Value receiver) const | ||||
| { | ||||
|     if (TRY(m_window_object->has_own_property(property_name))) | ||||
|         return m_window_object->internal_get(property_name, (receiver == this) ? m_window_object : receiver); | ||||
|  | @ -83,12 +83,12 @@ JS::ThrowCompletionOr<JS::Value> ConsoleGlobalObject::internal_get(JS::PropertyN | |||
|     return Base::internal_get(property_name, receiver); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_set(JS::PropertyName const& property_name, JS::Value value, JS::Value receiver) | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_set(JS::PropertyKey const& property_name, JS::Value value, JS::Value receiver) | ||||
| { | ||||
|     return m_window_object->internal_set(property_name, value, (receiver == this) ? m_window_object : receiver); | ||||
| } | ||||
| 
 | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_delete(JS::PropertyName const& property_name) | ||||
| JS::ThrowCompletionOr<bool> ConsoleGlobalObject::internal_delete(JS::PropertyKey const& property_name) | ||||
| { | ||||
|     return m_window_object->internal_delete(property_name); | ||||
| } | ||||
|  |  | |||
|  | @ -27,12 +27,12 @@ public: | |||
|     virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_is_extensible() const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override; | ||||
|     virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyName const& name) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyName const& name, JS::PropertyDescriptor const& descriptor) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyName const& name) const override; | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyName const&, JS::Value) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyName const&, JS::Value value, JS::Value receiver) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyName const& name) override; | ||||
|     virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const& name) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const& name, JS::PropertyDescriptor const& descriptor) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override; | ||||
|     virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value) const override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override; | ||||
|     virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const& name) override; | ||||
|     virtual JS::ThrowCompletionOr<JS::MarkedValueList> internal_own_property_keys() const override; | ||||
| 
 | ||||
|     virtual void initialize_global_object() override; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling