Skip to content

Commit 1fbd57d

Browse files
committed
add comments
1 parent 987f427 commit 1fbd57d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rbx_binary/src/serializer/state.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ impl<'dom, 'db> TypeInfos<'dom, 'db> {
227227
}
228228

229229
impl<'dom, 'db: 'dom> TypeInfo<'dom, 'db> {
230+
/// Get or create a logical property from a visited property.
230231
fn get_or_create<'a>(
231232
&'a mut self,
232233
push_sstr: &mut impl FnMut(&Variant),
@@ -321,6 +322,7 @@ impl<'dom, 'db: 'dom> TypeInfo<'dom, 'db> {
321322
})
322323
};
323324

325+
// Is this property the canonical representation?
324326
let logical_index = if canonical_name == prop_name {
325327
// create logical property
326328
let prop_info = new_prop_info()?;
@@ -452,6 +454,7 @@ impl<'dom, 'db: 'dom, W: Write> SerializerState<'dom, 'db, W> {
452454
} = self;
453455

454456
let type_info = type_infos.get_or_create(instance.class);
457+
// This order is important! See the loop below for details.
455458
let desired_len = type_info.instances.len();
456459
type_info.instances.push(instance);
457460

0 commit comments

Comments
 (0)