소스 검색

LibJS: Align Temporal.{Calendar,TimeZone} id getters with toString

This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0bb391a
Linus Groh 2 년 전
부모
커밋
ca038c1a4e

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

@@ -73,8 +73,8 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::id_getter)
     // 2. Perform ? RequireInternalSlot(calendar, [[InitializedTemporalCalendar]]).
     auto* calendar = TRY(typed_this_object(vm));
 
-    // 3. Return ? ToString(calendar).
-    return { js_string(vm, TRY(Value(calendar).to_string(vm))) };
+    // 3. Return calendar.[[Identifier]].
+    return { js_string(vm, calendar->identifier()) };
 }
 
 // 12.4.4 Temporal.Calendar.prototype.dateFromFields ( fields [ , options ] ), https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.datefromfields

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

@@ -52,8 +52,8 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::id_getter)
     // 2. Perform ? RequireInternalSlot(timeZone, [[InitializedTemporalTimeZone]]).
     auto* time_zone = TRY(typed_this_object(vm));
 
-    // 3. Return ? ToString(timeZone).
-    return js_string(vm, TRY(Value(time_zone).to_string(vm)));
+    // 3. Return timeZone.[[Identifier]].
+    return js_string(vm, time_zone->identifier());
 }
 
 // 11.4.4 Temporal.TimeZone.prototype.getOffsetNanosecondsFor ( instant ), https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getoffsetnanosecondsfor