Forráskód Böngészése

LibJS: Use more specific return types for some Temporal AOs

Instead of returning Object* we should be specific and return Instant*,
TimeZone* etc.
Linus Groh 4 éve
szülő
commit
6c8f0fbb35

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/Now.cpp

@@ -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);

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Temporal/Now.h

@@ -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&);
 
 }

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.cpp

@@ -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();
 

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Temporal/TimeZone.h

@@ -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);