fix: 对齐 counter/emitter 指令条数,修解构参数、数组赋值元素、解构catch、for-init 无初始化的跳转漂移
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user