mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03: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
Notes:
sideshowbarker
2024-07-17 02:35:27 +09:00
Author: https://github.com/BodilessSleeper Commit: https://github.com/SerenityOS/serenity/commit/c5daa6d997 Pull-request: https://github.com/SerenityOS/serenity/pull/17004 Reviewed-by: https://github.com/linusg ✅
@ -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…
Reference in New Issue
Block a user