mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
LibJS: Remove assertions replaced with structured headers
This is an editorial change in the Temporal spec.
See: 74fd5e8
This commit is contained in:
parent
c3f1d8f5ba
commit
9400b76d79
1 changed files with 8 additions and 12 deletions
|
@ -1849,13 +1849,11 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object,
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. Assert: Type(fields) is Object.
|
// 1. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
|
|
||||||
// 2. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
|
||||||
auto* result = Object::create(global_object, global_object.object_prototype());
|
auto* result = Object::create(global_object, global_object.object_prototype());
|
||||||
VERIFY(result);
|
VERIFY(result);
|
||||||
|
|
||||||
// 3. For each value property of fieldNames, do
|
// 2. For each value property of fieldNames, do
|
||||||
for (auto& property : field_names) {
|
for (auto& property : field_names) {
|
||||||
// a. Let value be ? Get(fields, property).
|
// a. Let value be ? Get(fields, property).
|
||||||
auto value = TRY(fields.get(property));
|
auto value = TRY(fields.get(property));
|
||||||
|
@ -1891,7 +1889,7 @@ ThrowCompletionOr<Object*> prepare_temporal_fields(GlobalObject& global_object,
|
||||||
MUST(result->create_data_property_or_throw(property, value));
|
MUST(result->create_data_property_or_throw(property, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Return result.
|
// 3. Return result.
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1900,15 +1898,13 @@ ThrowCompletionOr<Object*> prepare_partial_temporal_fields(GlobalObject& global_
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
// 1. Assert: Type(fields) is Object.
|
// 1. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
|
|
||||||
// 2. Let result be OrdinaryObjectCreate(%Object.prototype%).
|
|
||||||
auto* result = Object::create(global_object, global_object.object_prototype());
|
auto* result = Object::create(global_object, global_object.object_prototype());
|
||||||
|
|
||||||
// 3. Let any be false.
|
// 2. Let any be false.
|
||||||
auto any = false;
|
auto any = false;
|
||||||
|
|
||||||
// 4. For each value property of fieldNames, do
|
// 3. For each value property of fieldNames, do
|
||||||
for (auto& property : field_names) {
|
for (auto& property : field_names) {
|
||||||
// a. Let value be ? Get(fields, property).
|
// a. Let value be ? Get(fields, property).
|
||||||
auto value = TRY(fields.get(property));
|
auto value = TRY(fields.get(property));
|
||||||
|
@ -1933,13 +1929,13 @@ ThrowCompletionOr<Object*> prepare_partial_temporal_fields(GlobalObject& global_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. If any is false, then
|
// 4. If any is false, then
|
||||||
if (!any) {
|
if (!any) {
|
||||||
// a. Throw a TypeError exception.
|
// a. Throw a TypeError exception.
|
||||||
return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalObjectMustHaveOneOf, String::join(", "sv, field_names));
|
return vm.throw_completion<TypeError>(global_object, ErrorType::TemporalObjectMustHaveOneOf, String::join(", "sv, field_names));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Return result.
|
// 5. Return result.
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue