fix(emit): 默认参数/解构默认值函数名推断(SetFunctionName)

This commit is contained in:
爱特每羊队
2026-08-07 20:15:35 +08:00
parent 5b70a21832
commit b49ac29414
2 changed files with 31 additions and 6 deletions
+2 -2
View File
@@ -811,7 +811,7 @@ impl Emitter {
ParamSpec::Pattern { synthetic_name, pattern, initializer } => {
let src_reg = ctx.lookup(synthetic_name)?;
let src_reg = if let Some(init) = initializer {
self.emit_default_if_undefined(src_reg, init, ctx)?
self.emit_default_if_undefined(src_reg, init, Some(synthetic_name), ctx)?
} else {
src_reg
};
@@ -821,7 +821,7 @@ impl Emitter {
if let Some(init) = initializer {
// 默认参数:实参为 undefined 时用默认值。
let reg = ctx.lookup(name)?;
self.emit_default_if_undefined(reg, init, ctx)?;
self.emit_default_if_undefined(reg, init, Some(name), ctx)?;
}
}
}