From 4a67dbdd5fed1923eb525b87103ecb5b399120d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=E7=89=B9=E6=AF=8F=E7=BE=8A=E9=98=9F?= Date: Fri, 5 Jun 2026 19:36:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E7=A9=BA?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E5=B1=9E=E6=80=A7=E5=93=A8=E5=85=B5=E5=80=BC?= =?UTF-8?q?=E4=BA=A7=E7=94=9F=E7=9A=84=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide_vm/src/shape.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/oxide_vm/src/shape.rs b/crates/oxide_vm/src/shape.rs index 79abd1a..237df4b 100644 --- a/crates/oxide_vm/src/shape.rs +++ b/crates/oxide_vm/src/shape.rs @@ -6,6 +6,7 @@ pub type ShapeId = u32; pub type StringIndex = u32; pub const EMPTY_SHAPE_ID: ShapeId = 1; +const EMPTY_SENTINEL: StringIndex = u32::MAX; #[derive(Debug, Clone)] pub struct Shape { @@ -35,7 +36,7 @@ impl ShapeStore { fn create_empty_shape(&mut self) { let empty = Arc::new(Shape { id: EMPTY_SHAPE_ID, - property_name: 0, + property_name: EMPTY_SENTINEL, property_offset: 0, parent: None, }); @@ -80,7 +81,7 @@ impl ShapeStore { while let Some(id) = cursor { match self.get_shape(id) { Some(s) => { - if s.property_name != 0 { + if s.property_name != EMPTY_SENTINEL { count += 1; } cursor = s.parent; @@ -96,7 +97,7 @@ impl ShapeStore { while let Some(id) = cursor { match self.get_shape(id) { Some(s) => { - if s.property_name == prop_name { + if s.property_name == prop_name && s.property_name != EMPTY_SENTINEL { return Some(s.property_offset); } cursor = s.parent; @@ -113,7 +114,7 @@ impl ShapeStore { while let Some(id) = cursor { match self.get_shape(id) { Some(s) => { - if s.property_name != 0 { + if s.property_name != EMPTY_SENTINEL { count += 1; } cursor = s.parent;