feat: 函数 length 属性(字节码函数/bind 包装器)+ getter/setter name 前缀

This commit is contained in:
爱特每羊队
2026-08-09 15:38:45 +08:00
parent 8f8c9a39ff
commit c65d7e0373
10 changed files with 263 additions and 19 deletions
@@ -45,7 +45,13 @@ impl Emitter {
}
let accessor_reg = self.emit_expression(&p.value, ctx)?;
if let Some(sub_mod) = ctx.nested.last_mut() {
sub_mod.function_name = Some(prop_name.to_string());
// 访问器函数名带 "get "/"set " 前缀(SetFunctionName 语义)。
let fn_name = match p.kind {
PropertyKind::Get => format!("get {prop_name}"),
PropertyKind::Set => format!("set {prop_name}"),
_ => prop_name.clone(),
};
sub_mod.function_name = Some(fn_name);
}
let undef_reg = self.emit_undefined(ctx);
let (get_reg, set_reg) = if p.kind == PropertyKind::Get {