feat: 函数名登记为作用域内不可写绑定并按帧槽写入函数对象

This commit is contained in:
2026-10-09 21:32:51 +00:00
parent 71904a644f
commit 4f6bd5d947
16 changed files with 271 additions and 42 deletions
+5
View File
@@ -66,6 +66,9 @@ pub struct CompiledModule {
pub captured_this_const_idx: u16,
/// 由赋值上下文推断的函数名,在变量声明 / 对象属性赋值点设置。
pub function_name: Option<String>,
/// 函数名不可写绑定的寄存器(帧槽写入目标):压帧时把 callee 函数对象写入该槽。
/// `None` 表示无名绑定(匿名函数 / 形参或 var 同名抑制 / arguments 特例)。
pub function_name_reg: Option<u32>,
/// 函数 `length` 属性值:第一个带默认值/解构默认的形参之前的形参数(rest 不计)。
pub function_length: u32,
/// 形参列表是否 simple(全部无初始值标识符且无 rest):arguments 对象
@@ -110,6 +113,7 @@ impl CompiledModule {
is_strict: false,
captured_this_const_idx: 0,
function_name: None,
function_name_reg: None,
function_length: 0,
has_simple_params: false,
is_class_constructor: false,
@@ -146,6 +150,7 @@ impl Clone for CompiledModule {
is_strict: self.is_strict,
captured_this_const_idx: self.captured_this_const_idx,
function_name: self.function_name.clone(),
function_name_reg: self.function_name_reg,
function_length: self.function_length,
has_simple_params: self.has_simple_params,
is_class_constructor: self.is_class_constructor,