fix: 自导入别名与源同时捕获时合并单元

This commit is contained in:
2026-09-17 23:10:48 +00:00
parent 12ac57c877
commit 5768febadb
4 changed files with 114 additions and 20 deletions
+2
View File
@@ -683,6 +683,8 @@ impl CompileCtx {
param_layout,
builtin_reg_map: std::mem::take(&mut self.scopes.builtin_reg_map),
upvalue_captures,
// 容量按名字集大小取:别名捕获合并会让多个名字共享同一 cell,
// 下标可重复但不超过名字数,故 len 恒覆盖实际使用的最大下标。
cells_needed: self.captured_bindings.len() as u8,
n_registers: self.max_regs,
is_arrow: false,