1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:18:12 +00:00

LibJS: Implement the required AOs for Temporal.Duration.compare

This commit is contained in:
Luke Wilde 2021-11-09 17:19:28 +00:00 committed by Linus Groh
parent 98b9a75591
commit 29072f4b09
9 changed files with 413 additions and 5 deletions

View file

@ -161,7 +161,7 @@ ThrowCompletionOr<PlainDate*> calendar_date_add(GlobalObject& global_object, Obj
}
// 12.1.8 CalendarDateUntil ( calendar, one, two, options [ , dateUntil ] ), https://tc39.es/proposal-temporal/#sec-temporal-calendardateuntil
ThrowCompletionOr<Duration*> calendar_date_until(GlobalObject& global_object, Object& calendar, PlainDate& one, PlainDate& two, Object& options, FunctionObject* date_until)
ThrowCompletionOr<Duration*> calendar_date_until(GlobalObject& global_object, Object& calendar, Value one, Value two, Object& options, FunctionObject* date_until)
{
auto& vm = global_object.vm();
@ -172,7 +172,7 @@ ThrowCompletionOr<Duration*> calendar_date_until(GlobalObject& global_object, Ob
date_until = TRY(Value(&calendar).get_method(global_object, vm.names.dateUntil));
// 3. Let duration be ? Call(dateUntil, calendar, « one, two, options »).
auto duration = TRY(call(global_object, date_until ?: js_undefined(), &calendar, &one, &two, &options));
auto duration = TRY(call(global_object, date_until ?: js_undefined(), &calendar, one, two, &options));
// 4. Perform ? RequireInternalSlot(duration, [[InitializedTemporalDuration]]).
auto* duration_object = TRY(duration.to_object(global_object));