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
+7 -1
View File
@@ -112,7 +112,13 @@ impl Emitter {
)?;
ctx.in_instance_method = saved_instance;
ctx.in_static_method = saved_static;
method_module.function_name = Some(method_name.to_string());
// 访问器函数名带 "get "/"set " 前缀(SetFunctionName 语义),普通方法裸属性名。
let display_name = match method.kind {
MethodDefinitionKind::Get => format!("get {method_name}"),
MethodDefinitionKind::Set => format!("set {method_name}"),
_ => method_name.to_string(),
};
method_module.function_name = Some(display_name);
method_module.needs_home_object = true;
ctx.nested.push(method_module);
let method_reg = ctx.alloc_reg();