From 2ce3d4389aaf513163855a531364955401e39b32 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 14 Jun 2022 23:51:50 +0100 Subject: [PATCH] LibJS: Use existing variable instead of re-reading internal slot This is an editorial change in the Temporal spec. See: https://github.com/tc39/proposal-temporal/commit/8d62569 --- .../LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index f9c373add5..c85cde9e4b 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -1012,9 +1012,8 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::round) // 16. Let startNs be instantStart.[[Nanoseconds]]. auto& start_ns = instant_start->nanoseconds(); - // 17. Let endNs be ? AddZonedDateTime(startNs, timeZone, zonedDateTime.[[Calendar]], 0, 0, 0, 1, 0, 0, 0, 0, 0, 0). - // TODO: Shouldn't `zonedDateTime.[[Calendar]]` be `calendar` for consistency? - auto* end_ns = TRY(add_zoned_date_time(global_object, start_ns, &time_zone, zoned_date_time->calendar(), 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)); + // 17. Let endNs be ? AddZonedDateTime(startNs, timeZone, calendar, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0). + auto* end_ns = TRY(add_zoned_date_time(global_object, start_ns, &time_zone, calendar, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0)); // 18. Let dayLengthNs be ℝ(endNs - startNs). auto day_length_ns = end_ns->big_integer().minus(start_ns.big_integer()).to_double();