@@ -361,6 +361,34 @@ impl Builtin for TemporalInstantPrototypeGetEpochNanoSeconds {
361361 Behaviour :: Regular ( TemporalInstantPrototype :: get_epoch_nanoseconds) ;
362362}
363363
364+ struct TemporalInstantPrototypeAdd ;
365+ impl Builtin for TemporalInstantPrototypeAdd {
366+ const NAME : String < ' static > = BUILTIN_STRING_MEMORY . add ;
367+ const LENGTH : u8 = 1 ;
368+ const BEHAVIOUR : Behaviour = Behaviour :: Regular ( TemporalInstantPrototype :: add) ;
369+ }
370+
371+ struct TemporalInstantPrototypeSubtract ;
372+ impl Builtin for TemporalInstantPrototypeSubtract {
373+ const NAME : String < ' static > = BUILTIN_STRING_MEMORY . subtract ;
374+ const LENGTH : u8 = 1 ;
375+ const BEHAVIOUR : Behaviour = Behaviour :: Regular ( TemporalInstantPrototype :: subtract) ;
376+ }
377+
378+ struct TemporalInstantPrototypeUntil ;
379+ impl Builtin for TemporalInstantPrototypeUntil {
380+ const NAME : String < ' static > = BUILTIN_STRING_MEMORY . until ;
381+ const LENGTH : u8 = 1 ;
382+ const BEHAVIOUR : Behaviour = Behaviour :: Regular ( TemporalInstantPrototype :: until) ;
383+ }
384+
385+ struct TemporalInstantPrototypeSince ;
386+ impl Builtin for TemporalInstantPrototypeSince {
387+ const NAME : String < ' static > = BUILTIN_STRING_MEMORY . since ;
388+ const LENGTH : u8 = 1 ;
389+ const BEHAVIOUR : Behaviour = Behaviour :: Regular ( TemporalInstantPrototype :: since) ;
390+ }
391+
364392impl TemporalInstantPrototype {
365393 pub fn create_intrinsic ( agent : & mut Agent , realm : Realm < ' static > , _: NoGcScope ) {
366394 let intrinsics = agent. get_realm_record_by_id ( realm) . intrinsics ( ) ;
@@ -369,11 +397,15 @@ impl TemporalInstantPrototype {
369397 let instant_constructor = intrinsics. temporal_instant ( ) ;
370398
371399 OrdinaryObjectBuilder :: new_intrinsic_object ( agent, realm, this)
372- . with_property_capacity ( 3 )
400+ . with_property_capacity ( 7 )
373401 . with_prototype ( object_prototype)
374402 . with_constructor_property ( instant_constructor)
375403 . with_builtin_function_property :: < TemporalInstantPrototypeGetEpochMilliseconds > ( )
376404 . with_builtin_function_property :: < TemporalInstantPrototypeGetEpochNanoSeconds > ( )
405+ . with_builtin_function_property :: < TemporalInstantPrototypeAdd > ( )
406+ . with_builtin_function_property :: < TemporalInstantPrototypeSubtract > ( )
407+ . with_builtin_function_property :: < TemporalInstantPrototypeUntil > ( )
408+ . with_builtin_function_property :: < TemporalInstantPrototypeSince > ( )
377409 . build ( ) ;
378410 }
379411
@@ -410,7 +442,43 @@ impl TemporalInstantPrototype {
410442 . bind ( gc. nogc ( ) ) ;
411443 // 3. Return instant.[[EpochNanoseconds]].
412444 let value = instant. inner_instant ( agent) . epoch_nanoseconds ( ) . as_i128 ( ) ;
413- todo ! ( )
445+ Ok ( BigInt :: from_i128 ( agent, value) . into ( ) )
446+ }
447+
448+ fn add < ' gc > (
449+ _agent : & mut Agent ,
450+ _this_value : Value ,
451+ _args : ArgumentsList ,
452+ mut _gc : GcScope < ' gc , ' _ > ,
453+ ) -> JsResult < ' gc , Value < ' gc > > {
454+ unimplemented ! ( )
455+ }
456+
457+ fn subtract < ' gc > (
458+ _agent : & mut Agent ,
459+ _this_value : Value ,
460+ _args : ArgumentsList ,
461+ mut _gc : GcScope < ' gc , ' _ > ,
462+ ) -> JsResult < ' gc , Value < ' gc > > {
463+ unimplemented ! ( )
464+ }
465+
466+ fn until < ' gc > (
467+ _agent : & mut Agent ,
468+ _this_value : Value ,
469+ _args : ArgumentsList ,
470+ mut _gc : GcScope < ' gc , ' _ > ,
471+ ) -> JsResult < ' gc , Value < ' gc > > {
472+ unimplemented ! ( )
473+ }
474+
475+ fn since < ' gc > (
476+ _agent : & mut Agent ,
477+ _this_value : Value ,
478+ _args : ArgumentsList ,
479+ mut _gc : GcScope < ' gc , ' _ > ,
480+ ) -> JsResult < ' gc , Value < ' gc > > {
481+ unimplemented ! ( )
414482 }
415483}
416484
0 commit comments