mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:27:35 +00:00
LibJS: Make ToRelativeTemporalObject return a RelativeTo struct
This follows a change in the spec which refactored this function and its callers to make use of a record instead of stuffing all of the possible return values into a single Value. As always in temporal land, this AO remains out of date, as well of all its callers. Update all of these callers to the new API where possible, and use an ad-hoc function to convert this struct back to a JS::Value for APIs that have not been updated yet.
This commit is contained in:
parent
fa692ae3f6
commit
c063bf39a9
6 changed files with 101 additions and 70 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/Temporal/ISO8601.h>
|
||||
#include <LibJS/Runtime/Temporal/TimeZoneMethods.h>
|
||||
#include <LibJS/Runtime/ValueInlines.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
@ -148,7 +149,16 @@ ThrowCompletionOr<u64> to_temporal_rounding_increment(VM&, Object const& normali
|
|||
ThrowCompletionOr<u64> to_temporal_date_time_rounding_increment(VM&, Object const& normalized_options, StringView smallest_unit);
|
||||
ThrowCompletionOr<SecondsStringPrecision> to_seconds_string_precision(VM&, Object const& normalized_options);
|
||||
ThrowCompletionOr<Optional<String>> get_temporal_unit(VM&, Object const& normalized_options, PropertyKey const&, UnitGroup, TemporalUnitDefault const& default_, Vector<StringView> const& extra_values = {});
|
||||
ThrowCompletionOr<Value> to_relative_temporal_object(VM&, Object const& options);
|
||||
|
||||
struct RelativeTo {
|
||||
GCPtr<PlainDate> plain_relative_to; // [[PlainRelativeTo]]
|
||||
GCPtr<ZonedDateTime> zoned_relative_to; // [[ZonedRelativeTo]]
|
||||
Optional<TimeZoneMethods> time_zone_record; // [[TimeZoneRec]]
|
||||
};
|
||||
ThrowCompletionOr<RelativeTo> to_relative_temporal_object(VM&, Object const& options);
|
||||
|
||||
Value relative_to_converted_to_value(RelativeTo const&);
|
||||
|
||||
StringView larger_of_two_temporal_units(StringView, StringView);
|
||||
ThrowCompletionOr<Object*> merge_largest_unit_option(VM&, Object const& options, String largest_unit);
|
||||
Optional<u16> maximum_temporal_duration_rounding_increment(StringView unit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue