@@ -377,6 +377,7 @@ public class JavaScriptEnvironment: ComponentBase {
377377 registerObjectGroup ( . jsWasmTag)
378378 registerObjectGroup ( . jsWasmSuspendingObject)
379379 registerObjectGroup ( . jsTemporalObject)
380+ registerObjectGroup ( . jsTemporalNow)
380381 registerObjectGroup ( . jsTemporalInstant)
381382 registerObjectGroup ( . jsTemporalInstantConstructor)
382383 registerObjectGroup ( . jsTemporalInstantPrototype)
@@ -1041,7 +1042,7 @@ public extension ILType {
10411042 static let wasmTable = ILType . object ( ofGroup: " WasmTable " , withProperties: [ " length " ] , withMethods: [ " get " , " grow " , " set " ] )
10421043
10431044 // Temporal types
1044- static let jsTemporalObject = ILType . object ( ofGroup: " Temporal " , withProperties: [ " Instant " , " Duration " , " PlainTime " , " PlainYearMonth " , " PlainMonthDay " , " PlainDate " , " PlainDateTime " , " ZonedDateTime " ] )
1045+ static let jsTemporalObject = ILType . object ( ofGroup: " Temporal " , withProperties: [ " Instant " , " Duration " , " PlainTime " , " PlainYearMonth " , " PlainMonthDay " , " PlainDate " , " PlainDateTime " , " ZonedDateTime " , " Now " ] )
10451046
10461047 // TODO(mliedtke): Can we stop documenting Object.prototype methods? It doesn't make much sense that half of the ObjectGroups register a toString method,
10471048 // the other half doesn't and not a single one registers e.g. propertyIsEnumerable or isPrototypeOf.`?
@@ -1088,6 +1089,8 @@ public extension ILType {
10881089 static let jsTemporalZonedDateTime = ILType . object ( ofGroup: " Temporal.ZonedDateTime " , withProperties: dateProperties + timeProperties + [ " timeZoneId " , " epochMilliseconds " , " epochNanoseconds " , " offsetNanoseconds " , " offset " ] , withMethods: [ " with " , " withPlainTime " , " withTimeZone " , " withCalendar " , " add " , " subtract " , " until " , " since " , " round " , " equals " , " startOfDay " , " getTimeZoneTransition " , " toInstant " , " toPlainDate " , " toPlainTime " , " toPlainDateTime " ] + commonStringifierMethods)
10891090
10901091 static let jsTemporalZonedDateTimeConstructor = ILType . functionAndConstructor ( [ . bigint, . string, . opt( . jsTemporalCalendarEnum) ] => . jsTemporalZonedDateTime) + . object( ofGroup: " TemporalZonedDateTimeConstructor " , withProperties: [ " prototype " ] , withMethods: [ " from " , " compare " ] )
1092+
1093+ static let jsTemporalNow = ILType . object ( ofGroup: " Temporal.Now " , withProperties: [ ] , withMethods: [ " timeZoneId " , " instant " , " plainDateTimeISO " , " zonedDateTimeISO " , " plainDateISO " , " plainTimeISO " ] )
10911094}
10921095
10931096public extension ObjectGroup {
@@ -2065,10 +2068,26 @@ public extension ObjectGroup {
20652068 " PlainDate " : . jsTemporalPlainDateConstructor,
20662069 " PlainDateTime " : . jsTemporalPlainDateTimeConstructor,
20672070 " ZonedDateTime " : . jsTemporalZonedDateTimeConstructor,
2071+ " Now " : . jsTemporalNow,
20682072 ] ,
20692073 methods: [ : ]
20702074 )
20712075
2076+ static let jsTemporalNow = ObjectGroup (
2077+ name: " Temporal.Now " ,
2078+ instanceType: . jsTemporalNow,
2079+ properties: [ : ] ,
2080+ methods: [
2081+ " timeZoneId " : [ ] => . string,
2082+ " instant " : [ ] => . jsTemporalInstant,
2083+ // TODO(manishearth, 439921647) Potentially hint to the generator that these are timezone-like
2084+ " plainDateTimeISO " : [ . opt( . string) ] => . jsTemporalPlainDateTime,
2085+ " zonedDateTimeISO " : [ . opt( . string) ] => . jsTemporalZonedDateTime,
2086+ " plainDateISO " : [ . opt( . string) ] => . jsTemporalPlainDate,
2087+ " plainTimeISO " : [ . opt( . string) ] => . jsTemporalPlainTime,
2088+ ]
2089+ )
2090+
20722091 /// ObjectGroup modelling JavaScript Temporal.Instant objects
20732092 static let jsTemporalInstant = ObjectGroup (
20742093 name: " Temporal.Instant " ,
0 commit comments