fix: for-in 整数索引升序+字符串插入序枚举,null/undefined 空遍历

This commit is contained in:
爱特每羊队
2026-06-27 17:15:32 +08:00
parent 6e74881cde
commit ec380802a8
5 changed files with 176 additions and 8 deletions
+5 -3
View File
@@ -103,7 +103,9 @@ pub struct CallFrame {
}
pub struct ForInIter<'bump> {
pub keys: bumpalo::collections::Vec<'bump, JsValue>,
/// Each key paired with its string-intern id, so for-in can sort
/// integer-index keys ahead of string keys without re-interning.
pub keys: bumpalo::collections::Vec<'bump, (JsValue, u32)>,
pub index: usize,
}
@@ -358,8 +360,8 @@ impl Vm {
continue;
}
unsafe {
for &v in (*(*iter)).keys.iter() {
f(v);
for (v, _si) in (*(*iter)).keys.iter() {
f(*v);
}
}
}