1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:17:35 +00:00

LibJS: Use the direct formatter of PropertyName instead of via to_value

This commit is contained in:
davidot 2021-07-05 01:59:26 +02:00 committed by Linus Groh
parent c52d515028
commit 721238f41c

View file

@ -29,9 +29,9 @@ void Reference::put_value(GlobalObject& global_object, Value value)
// FIXME: This is an ad-hoc hack until we support proper variable bindings. // FIXME: This is an ad-hoc hack until we support proper variable bindings.
if (!m_base_value.is_object() && vm.in_strict_mode()) { if (!m_base_value.is_object() && vm.in_strict_mode()) {
if (m_base_value.is_nullish()) if (m_base_value.is_nullish())
vm.throw_exception<TypeError>(global_object, ErrorType::ReferenceNullishSetProperty, m_name.to_value(vm).to_string_without_side_effects(), m_base_value.to_string_without_side_effects()); vm.throw_exception<TypeError>(global_object, ErrorType::ReferenceNullishSetProperty, m_name, m_base_value.to_string_without_side_effects());
else else
vm.throw_exception<TypeError>(global_object, ErrorType::ReferencePrimitiveSetProperty, m_name.to_value(vm).to_string_without_side_effects(), m_base_value.typeof(), m_base_value.to_string_without_side_effects()); vm.throw_exception<TypeError>(global_object, ErrorType::ReferencePrimitiveSetProperty, m_name, m_base_value.typeof(), m_base_value.to_string_without_side_effects());
return; return;
} }
@ -43,7 +43,7 @@ void Reference::put_value(GlobalObject& global_object, Value value)
if (vm.exception()) if (vm.exception())
return; return;
if (!succeeded && m_strict) { if (!succeeded && m_strict) {
vm.throw_exception<TypeError>(global_object, ErrorType::ReferenceNullishSetProperty, m_name.to_value(vm).to_string_without_side_effects(), m_base_value.to_string_without_side_effects()); vm.throw_exception<TypeError>(global_object, ErrorType::ReferenceNullishSetProperty, m_name, m_base_value.to_string_without_side_effects());
return; return;
} }
return; return;
@ -68,7 +68,7 @@ void Reference::put_value(GlobalObject& global_object, Value value)
if (!succeeded && m_strict) { if (!succeeded && m_strict) {
// FIXME: This is a hack and will disappear when we support proper variable bindings. // FIXME: This is a hack and will disappear when we support proper variable bindings.
vm.throw_exception<TypeError>(global_object, ErrorType::DescWriteNonWritable, m_name.to_value(vm).to_string_without_side_effects()); vm.throw_exception<TypeError>(global_object, ErrorType::DescWriteNonWritable, m_name);
return; return;
} }
} }
@ -153,7 +153,7 @@ bool Reference::delete_(GlobalObject& global_object)
// e. If deleteStatus is false and ref.[[Strict]] is true, throw a TypeError exception. // e. If deleteStatus is false and ref.[[Strict]] is true, throw a TypeError exception.
if (!delete_status && m_strict) { if (!delete_status && m_strict) {
vm.throw_exception<TypeError>(global_object, ErrorType::ReferenceNullishDeleteProperty, m_name.to_value(vm).to_string_without_side_effects(), m_base_value.to_string_without_side_effects()); vm.throw_exception<TypeError>(global_object, ErrorType::ReferenceNullishDeleteProperty, m_name, m_base_value.to_string_without_side_effects());
return {}; return {};
} }