mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 03:01:12 +08:00
fix: catch 参数名补入捕获扫描且 catch 入口新 cell
This commit is contained in:
@@ -72,7 +72,10 @@ impl Emitter {
|
||||
let src_reg = ctx.alloc_reg();
|
||||
// 异常值在 VM 物理 regs[0](unwind 展开处写入),STORE_VAR a=None 读回。
|
||||
ctx.inst(Inst::new(OpCode::STORE_VAR, Operand::Reg(src_reg), Operand::None, Operand::None));
|
||||
self.emit_binding_pattern(¶m.pattern, src_reg, VariableDeclarationKind::Let, false, false, ctx)?;
|
||||
// 每次 catch 执行都为参数新建词法环境:被捕获参数在入口发
|
||||
// MAKE_CELL_FRESH(替换而非覆写上一入口的 cell),上一入口
|
||||
// 闭包持有的旧 cell 指针仍可读到旧值。
|
||||
self.emit_binding_pattern(¶m.pattern, src_reg, VariableDeclarationKind::Let, false, true, ctx)?;
|
||||
}
|
||||
// catch 块函数预声明先于 lexical,块入口物化与 try/普通块同口径。
|
||||
self.predeclare_block_function_declarations(&catch.body.body, ctx, false);
|
||||
|
||||
Reference in New Issue
Block a user