fix: null dynamic attrs

This commit is contained in:
2026-05-05 00:28:38 +08:00
parent 4aff27142c
commit 49392f66f8
4 changed files with 13 additions and 14 deletions
+7 -4
View File
@@ -24,12 +24,13 @@ impl<'gc> crate::Vm<'gc> {
self.force_slot_to_pc(depth, reader, mc, reader.inst_start_pc())?;
}
let mut dyn_keys: SmallVec<[crate::StringId; 2]> = SmallVec::with_capacity(dynamic_count);
let mut dyn_keys: SmallVec<[_; 2]> = SmallVec::with_capacity(dynamic_count);
for i in 0..dynamic_count {
let depth = dynamic_count - 1 - i;
let key_val = self.peek_forced(depth);
let key_sid = match ctx.get_string_id(key_val) {
Ok(id) => id,
Ok(id) => Some(id),
Err(NixType::Null) => None,
Err(got) => return self.finish_type_err(NixType::String, got),
};
dyn_keys.push(key_sid);
@@ -47,10 +48,12 @@ impl<'gc> crate::Vm<'gc> {
kv.push((key, val));
}
for i in 0..dynamic_count {
for key in dyn_keys {
let val = reader.read_operand_data(ctx).resolve(mc, self);
let _span_id = reader.read_u32();
kv.push((dyn_keys[i], val));
if let Some(key) = key {
kv.push((key, val))
}
}
kv.sort_by_key(|(k, _)| *k);