/* * Copyright (c) 2024, Shannon Booth * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace JS::Temporal { // 11.5.1 Time Zone Methods Records, https://tc39.es/proposal-temporal/#sec-temporal-time-zone-methods-records struct TimeZoneMethods { // The time zone object, or a string indicating a built-in time zone. Variant> receiver; // [[Reciever]] // The time zone's getOffsetNanosecondsFor method. For a built-in time zone this is always %Temporal.TimeZone.prototype.getOffsetNanosecondsFor%. GCPtr get_offset_nanoseconds_for; // [[GetOffsetNanosecondsFor]] // The time zone's getPossibleInstantsFor method. For a built-in time zone this is always %Temporal.TimeZone.prototype.getPossibleInstantsFor%. GCPtr get_possible_instants_for; // [[GetPossibleInstantsFor]] }; #define JS_ENUMERATE_TIME_ZONE_METHODS \ __JS_ENUMERATE(GetOffsetNanosecondsFor, getOffsetNanosecondsFor, get_offset_nanoseconds_for) \ __JS_ENUMERATE(GetPossibleInstantsFor, getPossibleInstantsFor, get_possible_instants_for) enum class TimeZoneMethod { #define __JS_ENUMERATE(PascalName, camelName, snake_name) \ PascalName, JS_ENUMERATE_TIME_ZONE_METHODS #undef __JS_ENUMERATE }; ThrowCompletionOr time_zone_methods_record_lookup(VM&, TimeZoneMethods&, TimeZoneMethod); ThrowCompletionOr create_time_zone_methods_record(VM&, Variant> time_zone, ReadonlySpan); bool time_zone_methods_record_has_looked_up(TimeZoneMethods const&, TimeZoneMethod); bool time_zone_methods_record_is_builtin(TimeZoneMethods const&); ThrowCompletionOr time_zone_methods_record_call(VM&, TimeZoneMethods const&, TimeZoneMethod, ReadonlySpan arguments); }