mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
LibJS: Remove redundant ToString from ToTemporalZonedDateTime
Assert that the type of offsetString is either undefined or string in order to avoid unnecessary ToString Temporal commit: tc39/proposal-temporal@24ebcbd
This commit is contained in:
parent
219db02b2f
commit
c5daa6d997
1 changed files with 4 additions and 6 deletions
|
@ -167,16 +167,14 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
|
|||
// i. Let offsetString be ! Get(fields, "offset").
|
||||
auto offset_string_value = MUST(fields->get(vm.names.offset));
|
||||
|
||||
// j. If offsetString is undefined, then
|
||||
// j. Assert: offsetString is a String or undefined.
|
||||
VERIFY(offset_string_value.is_string() || offset_string_value.is_undefined());
|
||||
|
||||
// k. If offsetString is undefined, then
|
||||
if (offset_string_value.is_undefined()) {
|
||||
// i. Set offsetBehaviour to wall.
|
||||
offset_behavior = OffsetBehavior::Wall;
|
||||
}
|
||||
// k. Else,
|
||||
else {
|
||||
// i. Set offsetString to ? ToString(offsetString).
|
||||
offset_string = TRY(offset_string_value.to_deprecated_string(vm));
|
||||
}
|
||||
|
||||
// l. Let result be ? InterpretTemporalDateTimeFields(calendar, fields, options).
|
||||
result = TRY(interpret_temporal_date_time_fields(vm, *calendar, *fields, *options));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue