Debian Codegraph @

js/src/tests/test262/built-ins/Temporal/PlainYearMonth/from/calendar-temporal-object.js

raw
1 // |reftest| shell-option(--enable-temporal) skip-if(!this.hasOwnProperty('Temporal')||!xulRuntime.shell) -- Temporal is not enabled unconditionally, requires shell-options
2 // Copyright (C) 2021 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4
5 /*---
6 esid: sec-temporal.plainyearmonth.from
7 description: Fast path for converting other Temporal objects to Temporal.Calendar by reading internal slots
8 info: |
9 sec-temporal.plainyearmonth.from step 3:
10 3. Return ? ToTemporalYearMonth(_item_, _options_).
11 sec-temporal-totemporaldate step 2.b:
12 b. Let _calendar_ be ? GetTemporalCalendarWithISODefault(_item_).
13 sec-temporal-gettemporalcalendarwithisodefault step 2:
14 2. Return ? ToTemporalCalendarWithISODefault(_calendar_).
15 sec-temporal-totemporalcalendarwithisodefault step 2:
16 3. Return ? ToTemporalCalendar(_temporalCalendarLike_).
17 sec-temporal-totemporalcalendar step 1.a:
18 a. If _temporalCalendarLike_ has an [[InitializedTemporalDate]], [[InitializedTemporalDateTime]], [[InitializedTemporalMonthDay]], [[InitializedTemporalYearMonth]], or [[InitializedTemporalZonedDateTime]] internal slot, then
19 i. Return _temporalCalendarLike_.[[Calendar]].
20 includes: [compareArray.js, temporalHelpers.js]
21 features: [Temporal]
22 ---*/
23
24 TemporalHelpers.checkToTemporalCalendarFastPath((temporalObject) => {
25 const result = Temporal.PlainYearMonth.from({ year: 2000, month: 5, calendar: temporalObject });
26 assert.sameValue(result.calendarId, "iso8601", "Temporal object coerced to calendar");
27 });
28
29 reportCompare(0, 0);