mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 10:22:13 +00:00
LibJS: Remove infallibility markers from some Intl.DurationFormat AOs
This is an editorial change in the Intl.DurationFormat proposal. See:
fa2b3d0
This commit is contained in:
parent
3aeb7a41c0
commit
0086a3acdb
2 changed files with 7 additions and 7 deletions
|
@ -204,7 +204,7 @@ i8 duration_record_sign(Temporal::DurationRecord const& record)
|
||||||
// 1.1.5 IsValidDurationRecord ( record ), https://tc39.es/proposal-intl-duration-format/#sec-isvaliddurationrecord
|
// 1.1.5 IsValidDurationRecord ( record ), https://tc39.es/proposal-intl-duration-format/#sec-isvaliddurationrecord
|
||||||
bool is_valid_duration_record(Temporal::DurationRecord const& record)
|
bool is_valid_duration_record(Temporal::DurationRecord const& record)
|
||||||
{
|
{
|
||||||
// 1. Let sign be ! DurationRecordSign(record).
|
// 1. Let sign be DurationRecordSign(record).
|
||||||
auto sign = duration_record_sign(record);
|
auto sign = duration_record_sign(record);
|
||||||
|
|
||||||
// 2. For each row of Table 1, except the header row, in table order, do
|
// 2. For each row of Table 1, except the header row, in table order, do
|
||||||
|
@ -338,7 +338,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
|
||||||
// h. Let value be duration.[[<valueSlot>]].
|
// h. Let value be duration.[[<valueSlot>]].
|
||||||
auto value = duration.*value_slot;
|
auto value = duration.*value_slot;
|
||||||
|
|
||||||
// i. Let nfOpts be ! OrdinaryObjectCreate(null).
|
// i. Let nfOpts be OrdinaryObjectCreate(null).
|
||||||
auto number_format_options = Object::create(realm, nullptr);
|
auto number_format_options = Object::create(realm, nullptr);
|
||||||
|
|
||||||
// j. If unit is "seconds", "milliseconds", or "microseconds", then
|
// j. If unit is "seconds", "milliseconds", or "microseconds", then
|
||||||
|
@ -485,7 +485,7 @@ Vector<PatternPartition> partition_duration_format_pattern(VM& vm, DurationForma
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Let lfOpts be ! OrdinaryObjectCreate(null).
|
// 4. Let lfOpts be OrdinaryObjectCreate(null).
|
||||||
auto list_format_options = Object::create(realm, nullptr);
|
auto list_format_options = Object::create(realm, nullptr);
|
||||||
|
|
||||||
// 5. Perform ! CreateDataPropertyOrThrow(lfOpts, "type", "unit").
|
// 5. Perform ! CreateDataPropertyOrThrow(lfOpts, "type", "unit").
|
||||||
|
|
|
@ -46,7 +46,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format)
|
||||||
if (!is_valid_duration_record(record))
|
if (!is_valid_duration_record(record))
|
||||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationLikeObject);
|
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationLikeObject);
|
||||||
|
|
||||||
// 5. Let parts be ! PartitionDurationFormatPattern(df, record).
|
// 5. Let parts be PartitionDurationFormatPattern(df, record).
|
||||||
auto parts = partition_duration_format_pattern(vm, *duration_format, record);
|
auto parts = partition_duration_format_pattern(vm, *duration_format, record);
|
||||||
|
|
||||||
// 6. Let result be a new empty String.
|
// 6. Let result be a new empty String.
|
||||||
|
@ -78,7 +78,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format_to_parts)
|
||||||
if (!is_valid_duration_record(record))
|
if (!is_valid_duration_record(record))
|
||||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationLikeObject);
|
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidDurationLikeObject);
|
||||||
|
|
||||||
// 5. Let parts be ! PartitionDurationFormatPattern(df, record).
|
// 5. Let parts be PartitionDurationFormatPattern(df, record).
|
||||||
auto parts = partition_duration_format_pattern(vm, *duration_format, record);
|
auto parts = partition_duration_format_pattern(vm, *duration_format, record);
|
||||||
|
|
||||||
// 6. Let result be ! ArrayCreate(0).
|
// 6. Let result be ! ArrayCreate(0).
|
||||||
|
@ -89,7 +89,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::format_to_parts)
|
||||||
for (size_t n = 0; n < parts.size(); ++n) {
|
for (size_t n = 0; n < parts.size(); ++n) {
|
||||||
auto const& part = parts[n];
|
auto const& part = parts[n];
|
||||||
|
|
||||||
// a. Let obj be ! OrdinaryObjectCreate(%ObjectPrototype%).
|
// a. Let obj be OrdinaryObjectCreate(%ObjectPrototype%).
|
||||||
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
auto object = Object::create(realm, realm.intrinsics().object_prototype());
|
||||||
|
|
||||||
// b. Perform ! CreateDataPropertyOrThrow(obj, "type", part.[[Type]]).
|
// b. Perform ! CreateDataPropertyOrThrow(obj, "type", part.[[Type]]).
|
||||||
|
@ -117,7 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationFormatPrototype::resolved_options)
|
||||||
// 2. Perform ? RequireInternalSlot(df, [[InitializedDurationFormat]]).
|
// 2. Perform ? RequireInternalSlot(df, [[InitializedDurationFormat]]).
|
||||||
auto* duration_format = TRY(typed_this_object(vm));
|
auto* duration_format = TRY(typed_this_object(vm));
|
||||||
|
|
||||||
// 3. Let options be ! OrdinaryObjectCreate(%Object.prototype%).
|
// 3. Let options be OrdinaryObjectCreate(%Object.prototype%).
|
||||||
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
auto options = Object::create(realm, realm.intrinsics().object_prototype());
|
||||||
|
|
||||||
// 4. For each row of Table 2, except the header row, in table order, do
|
// 4. For each row of Table 2, except the header row, in table order, do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue