LibJS: Use more specific return types for some Temporal AOs
Instead of returning Object* we should be specific and return Instant*, TimeZone* etc.
This commit is contained in:
parent
be475cd6a8
commit
6c8f0fbb35
Notes:
sideshowbarker
2024-07-18 09:00:42 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/6c8f0fbb35f Pull-request: https://github.com/SerenityOS/serenity/pull/8753 Reviewed-by: https://github.com/IdanHo ✅
4 changed files with 6 additions and 6 deletions
|
@ -45,7 +45,7 @@ JS_DEFINE_NATIVE_FUNCTION(Now::instant)
|
|||
}
|
||||
|
||||
// 2.2.1 SystemTimeZone ( ), https://tc39.es/proposal-temporal/#sec-temporal-systemtimezone
|
||||
Object* system_time_zone(GlobalObject& global_object)
|
||||
TimeZone* system_time_zone(GlobalObject& global_object)
|
||||
{
|
||||
// 1. Let identifier be ! DefaultTimeZone().
|
||||
auto identifier = default_time_zone();
|
||||
|
@ -78,7 +78,7 @@ BigInt* system_utc_epoch_nanoseconds(GlobalObject& global_object)
|
|||
}
|
||||
|
||||
// 2.2.3 SystemInstant ( )
|
||||
Object* system_instant(GlobalObject& global_object)
|
||||
Instant* system_instant(GlobalObject& global_object)
|
||||
{
|
||||
// 1. Let ns be ! SystemUTCEpochNanoseconds().
|
||||
auto* ns = system_utc_epoch_nanoseconds(global_object);
|
||||
|
|
|
@ -23,8 +23,8 @@ private:
|
|||
JS_DECLARE_NATIVE_FUNCTION(instant);
|
||||
};
|
||||
|
||||
Object* system_time_zone(GlobalObject&);
|
||||
TimeZone* system_time_zone(GlobalObject&);
|
||||
BigInt* system_utc_epoch_nanoseconds(GlobalObject&);
|
||||
Object* system_instant(GlobalObject&);
|
||||
Instant* system_instant(GlobalObject&);
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ String default_time_zone()
|
|||
}
|
||||
|
||||
// 11.6.2 CreateTemporalTimeZone ( identifier [ , newTarget ] ), https://tc39.es/proposal-temporal/#sec-temporal-createtemporaltimezone
|
||||
Object* create_temporal_time_zone(GlobalObject& global_object, String const& identifier, FunctionObject* new_target)
|
||||
TimeZone* create_temporal_time_zone(GlobalObject& global_object, String const& identifier, FunctionObject* new_target)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ private:
|
|||
bool is_valid_time_zone_name(String const& time_zone);
|
||||
String canonicalize_time_zone_name(String const& time_zone);
|
||||
String default_time_zone();
|
||||
Object* create_temporal_time_zone(GlobalObject&, String const& identifier, FunctionObject* new_target = nullptr);
|
||||
TimeZone* create_temporal_time_zone(GlobalObject&, String const& identifier, FunctionObject* new_target = nullptr);
|
||||
double parse_time_zone_offset_string(GlobalObject&, String const&);
|
||||
String format_time_zone_offset_string(double offset_nanoseconds);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue