mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-26 03:31:12 +08:00
feat: 函数名登记为作用域内不可写绑定并按帧槽写入函数对象
This commit is contained in:
@@ -62,6 +62,9 @@ pub struct IRFunction {
|
||||
pub is_strict: bool,
|
||||
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 对象
|
||||
@@ -99,6 +102,7 @@ impl IRFunction {
|
||||
is_strict: false,
|
||||
captured_this_const_idx: 0,
|
||||
function_name: None,
|
||||
function_name_reg: None,
|
||||
function_length: 0,
|
||||
has_simple_params: false,
|
||||
is_top_level: false,
|
||||
|
||||
@@ -89,6 +89,7 @@ pub fn lower(f: &IRFunction) -> Result<CompiledModule, String> {
|
||||
is_strict: f.is_strict,
|
||||
captured_this_const_idx: f.captured_this_const_idx,
|
||||
function_name: f.function_name.clone(),
|
||||
function_name_reg: f.function_name_reg,
|
||||
function_length: f.function_length,
|
||||
has_simple_params: f.has_simple_params,
|
||||
is_class_constructor: f.is_class_constructor,
|
||||
|
||||
Reference in New Issue
Block a user