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
@@ -152,13 +152,13 @@ impl Emitter {
let body_stmts: &[Statement] = if let Some(body) = &fd.body { &body.statements } else { &[] };
let own_strict = fd.has_use_strict_directive();
let mut sub_module = if fd.generator && fd.r#async {
self.compile_async_generator_body(&param_names, body_stmts, ctx, own_strict)?
self.compile_async_generator_body(&param_names, body_stmts, ctx, own_strict, Some(name))?
} else if fd.generator {
self.compile_generator_body(&param_names, body_stmts, ctx, own_strict)?
self.compile_generator_body(&param_names, body_stmts, ctx, own_strict, Some(name))?
} else if fd.r#async {
self.compile_async_body(&param_names, body_stmts, ctx, false, false, own_strict)?
self.compile_async_body(&param_names, body_stmts, ctx, false, false, own_strict, Some(name))?
} else {
self.compile_function_body(&param_names, body_stmts, ctx, false, false, own_strict)?
self.compile_function_body(&param_names, body_stmts, ctx, false, false, own_strict, Some(name))?
};
sub_module.function_name = Some(name.to_string());
ctx.nested.push(sub_module);