feat: 共享 ThrowTypeError 对象并拆分 arguments callee 四象限

This commit is contained in:
2026-09-26 15:01:50 +00:00
parent d773cc7282
commit de236fb5d1
11 changed files with 138 additions and 67 deletions
+4
View File
@@ -61,6 +61,9 @@ pub struct IRFunction {
pub function_name: Option<String>,
/// 函数 `length` 属性值:第一个带默认值/解构默认的形参之前的形参数(rest 不计)。
pub function_length: u32,
/// 形参列表是否 simple(全部无初始值标识符且无 rest):arguments 对象
/// callee 形态(数据属性 vs 受限访问器)按 strict ‖ !simple 分流。
pub has_simple_params: bool,
/// 本函数是否为顶层脚本函数:顶层 STORE_VAR 写全局可观察状态,不可被精确 DCE
/// 删除;函数内局部 STORE_VAR 才可删。emit 在 assemble_ir 处由
/// `parent_ctx.is_none()` 填充;nested/手工构造默认 false。
@@ -93,6 +96,7 @@ impl IRFunction {
captured_this_const_idx: 0,
function_name: None,
function_length: 0,
has_simple_params: false,
is_top_level: false,
const_overflow: false,
nested: Vec::new(),
+1
View File
@@ -90,6 +90,7 @@ pub fn lower(f: &IRFunction) -> Result<CompiledModule, String> {
captured_this_const_idx: f.captured_this_const_idx,
function_name: f.function_name.clone(),
function_length: f.function_length,
has_simple_params: f.has_simple_params,
is_class_constructor: f.is_class_constructor,
is_derived_constructor: f.is_derived_constructor,
needs_home_object: f.needs_home_object,