mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-27 12:11:12 +08:00
fix: 对齐 counter/emitter 指令条数,修解构参数、数组赋值元素、解构catch、for-init 无初始化的跳转漂移
This commit is contained in:
@@ -40,9 +40,14 @@ impl Compiler {
|
||||
ctx.labels.label_map.insert(catch_label, ctx.projected_pc);
|
||||
if let Some(catch) = &stmt.handler {
|
||||
ctx.push_scope();
|
||||
if let Some(_param) = &catch.param {
|
||||
if let Some(param) = &catch.param {
|
||||
// Mirror the emitter: the catch register is always allocated, but STORE_VAR is
|
||||
// emitted only for an identifier binding — a destructuring catch param emits no
|
||||
// store (that binding form is not implemented yet).
|
||||
ctx.alloc_reg();
|
||||
ctx.projected_pc += 1; // STORE_VAR
|
||||
if let oxide_parser::BindingPattern::BindingIdentifier(_) = ¶m.pattern {
|
||||
ctx.projected_pc += 1; // STORE_VAR
|
||||
}
|
||||
}
|
||||
for cs in &catch.body.body {
|
||||
self.count_statement(cs, ctx);
|
||||
|
||||
Reference in New Issue
Block a user