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

LibJS: Convert Temporal.Calendar functions to ThrowCompletionOr

This commit is contained in:
Linus Groh 2021-10-21 19:55:55 +01:00
parent 649cb67f28
commit 2d2ba4eec6
4 changed files with 150 additions and 157 deletions

View file

@ -26,7 +26,7 @@ void CalendarConstructor::initialize(GlobalObject& global_object)
define_direct_property(vm.names.prototype, global_object.temporal_calendar_prototype(), 0);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_old_native_function(vm.names.from, from, 1, attr);
define_native_function(vm.names.from, from, 1, attr);
define_direct_property(vm.names.length, Value(1), Attribute::Configurable);
}
@ -61,12 +61,12 @@ ThrowCompletionOr<Object*> CalendarConstructor::construct(FunctionObject& new_ta
}
// 12.3.2 Temporal.Calendar.from ( item ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.from
JS_DEFINE_OLD_NATIVE_FUNCTION(CalendarConstructor::from)
JS_DEFINE_NATIVE_FUNCTION(CalendarConstructor::from)
{
auto item = vm.argument(0);
// 1. Return ? ToTemporalCalendar(item).
return TRY_OR_DISCARD(to_temporal_calendar(global_object, item));
return TRY(to_temporal_calendar(global_object, item));
}
}