feat: 解构模式语义补齐(REST 枚举/getter/computed 排除、IteratorClose、RegAlloc def 干涉、for-in 捕获遮蔽)

This commit is contained in:
2026-08-09 15:01:31 +08:00
parent c65f3be179
commit 36fb61fc74
12 changed files with 294 additions and 61 deletions
+17 -1
View File
@@ -180,7 +180,7 @@ pub(super) fn build(
at_i.push(fr.id);
}
}
// 两两加边
// 两两加边(基于 live_before:约束 use/def 与执行前存活值)
for a in 0..at_i.len() {
for b in a + 1..at_i.len() {
let (x, y) = (at_i[a], at_i[b]);
@@ -188,6 +188,22 @@ pub(super) fn build(
adj_sets.entry(y).or_default().insert(x);
}
}
// def 结果与执行后仍存活的值冲突(写覆盖):live_after 含 def 后存活者。
// live_before 已 kill def 自身,纯写指令(FOR_OF_NEXT 等)的结果若与长活
// 寄存器同色会覆盖其值(elision 解构返回值被覆盖),须补此干涉边。
if let Some(d) = f.insts[i].def_reg() {
if nodes.contains_key(&d) {
for &v in &node_ids {
if v == d {
continue;
}
if live.inst_live_after[i].get(v as usize).copied().unwrap_or(false) {
adj_sets.entry(d).or_default().insert(v);
adj_sets.entry(v).or_default().insert(d);
}
}
}
}
}
for (v, set) in adj_sets {
if let Some(node) = nodes.get_mut(&v) {