From 1a71e0b8d68b7859b19663a489175672cbc01fb1 Mon Sep 17 00:00:00 2001 From: pjh456 <147148383@qq.com> Date: Wed, 12 Aug 2026 14:37:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Temporal=20=E6=9E=84=E9=80=A0=E5=99=A8?= =?UTF-8?q?=E8=A1=A5=20length=20=E8=87=AA=E6=9C=89=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=EF=BC=88Instant/ZonedDateTime/PlainDate/PlainTime/Duration=20?= =?UTF-8?q?=E6=8C=89=E8=A7=84=E8=8C=83=20arity=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_vm/src/bindings/bind_temporal.rs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/crates/oxide_vm/src/bindings/bind_temporal.rs b/crates/oxide_vm/src/bindings/bind_temporal.rs index 353ce23e..c9965854 100644 --- a/crates/oxide_vm/src/bindings/bind_temporal.rs +++ b/crates/oxide_vm/src/bindings/bind_temporal.rs @@ -35,6 +35,16 @@ pub fn bind_temporal(core: &Arc, session: &KernelSession, global: &m oxide_builtins::temporal::instant_constructor:: as *const (), 1, ); + let length_si = core.perm_interner().intern("length").0; + let length_shape = core.shape_forge().make_shape(instant_ctor.shape_id(), length_si); + instant_ctor.set_shape_id(length_shape); + instant_ctor.ensure_hash_props().push(JsValue::int(1)); + let length_pos = instant_ctor + .hash_props_vec() + .map_or(0, |props| props.len() as u32) + .saturating_sub(1); + instant_ctor.set_data_meta(length_pos, PropAttributes::new(false, false, true)); + apply_binding_table( world, instant_ctor, @@ -129,6 +139,16 @@ pub fn bind_temporal(core: &Arc, session: &KernelSession, global: &m oxide_builtins::temporal::zoned_date_time_constructor:: as *const (), 2, ); + let length_si = core.perm_interner().intern("length").0; + let length_shape = core.shape_forge().make_shape(zoned_date_time_ctor.shape_id(), length_si); + zoned_date_time_ctor.set_shape_id(length_shape); + zoned_date_time_ctor.ensure_hash_props().push(JsValue::int(2)); + let length_pos = zoned_date_time_ctor + .hash_props_vec() + .map_or(0, |props| props.len() as u32) + .saturating_sub(1); + zoned_date_time_ctor.set_data_meta(length_pos, PropAttributes::new(false, false, true)); + let zoned_date_time_proto_ptr = world.zoned_date_time_proto.as_ptr() as *mut JsObject; let zoned_date_time_proto = unsafe { &mut *zoned_date_time_proto_ptr }; bind_accessor_getter( @@ -171,6 +191,16 @@ pub fn bind_temporal(core: &Arc, session: &KernelSession, global: &m oxide_builtins::temporal::plain_date_constructor:: as *const (), 3, ); + let length_si = core.perm_interner().intern("length").0; + let length_shape = core.shape_forge().make_shape(plain_date_ctor.shape_id(), length_si); + plain_date_ctor.set_shape_id(length_shape); + plain_date_ctor.ensure_hash_props().push(JsValue::int(3)); + let length_pos = plain_date_ctor + .hash_props_vec() + .map_or(0, |props| props.len() as u32) + .saturating_sub(1); + plain_date_ctor.set_data_meta(length_pos, PropAttributes::new(false, false, true)); + apply_binding_table( world, plain_date_ctor, @@ -322,6 +352,16 @@ pub fn bind_temporal(core: &Arc, session: &KernelSession, global: &m oxide_builtins::temporal::plain_time_constructor:: as *const (), 6, ); + let length_si = core.perm_interner().intern("length").0; + let length_shape = core.shape_forge().make_shape(plain_time_ctor.shape_id(), length_si); + plain_time_ctor.set_shape_id(length_shape); + plain_time_ctor.ensure_hash_props().push(JsValue::int(0)); + let length_pos = plain_time_ctor + .hash_props_vec() + .map_or(0, |props| props.len() as u32) + .saturating_sub(1); + plain_time_ctor.set_data_meta(length_pos, PropAttributes::new(false, false, true)); + let plain_time_proto_ptr = world.plain_time_proto.as_ptr() as *mut JsObject; let plain_time_proto = unsafe { &mut *plain_time_proto_ptr }; bind_accessor_getter( @@ -556,6 +596,16 @@ pub fn bind_temporal(core: &Arc, session: &KernelSession, global: &m oxide_builtins::temporal::duration_constructor:: as *const (), 10, ); + let length_si = core.perm_interner().intern("length").0; + let length_shape = core.shape_forge().make_shape(duration_ctor.shape_id(), length_si); + duration_ctor.set_shape_id(length_shape); + duration_ctor.ensure_hash_props().push(JsValue::int(0)); + let length_pos = duration_ctor + .hash_props_vec() + .map_or(0, |props| props.len() as u32) + .saturating_sub(1); + duration_ctor.set_data_meta(length_pos, PropAttributes::new(false, false, true)); + apply_binding_table( world, duration_ctor,