fix: 对齐 counter/emitter 指令条数,修解构参数、数组赋值元素、解构catch、for-init 无初始化的跳转漂移

This commit is contained in:
爱特每羊队
2026-06-27 20:32:33 +08:00
parent 3c92f8368c
commit 242e94af09
7 changed files with 104 additions and 14 deletions
+10
View File
@@ -721,6 +721,16 @@ impl Compiler {
ctx.declare_initialized(name, reg, VariableDeclarationKind::Var, false)?;
}
// Count the parameter destructuring prologue so the count pass matches the emit pass
// below (which emits it via emit_binding_pattern). Without this the projected program
// counter undercounts, drifting every jump target inside a function that has a
// destructured or default parameter.
for spec in param_specs {
if let ParamSpec::Pattern { pattern, .. } = spec {
self.count_binding_pattern(pattern, &mut ctx);
}
}
// Count pass
if !fields_after_super {
if let Some(count) = count_fields.as_mut() {