mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 10:41:11 +08:00
fix: 重写闭包捕获分析为 AST 级,修复 MAKE_CELL 时序
This commit is contained in:
@@ -42,7 +42,7 @@ impl Compiler {
|
||||
ctx.declare(name, var_reg, kind, is_const)?;
|
||||
var_reg
|
||||
};
|
||||
if ctx.scopes.symbols.lookup_is_captured(name) {
|
||||
if ctx.captured_bindings.contains(name) {
|
||||
let cell_idx = ctx.scopes.cell_registry.len() as u8;
|
||||
ctx.scopes.cell_registry.push((name.to_string(), cell_idx));
|
||||
ctx.inst(Inst::new(OpCode::MAKE_CELL, Operand::Reg(src_reg as u32), Operand::Imm(cell_idx as u16), Operand::None));
|
||||
|
||||
Reference in New Issue
Block a user