refactor: 函数 strict 标志入 IR/编译/缓存链(零行为地基)

This commit is contained in:
2026-08-16 16:46:33 +08:00
parent f1c4b33735
commit 089179daab
10 changed files with 89 additions and 20 deletions
@@ -43,14 +43,15 @@ impl Emitter {
self.push_rest_param(&rest.rest.argument, &mut param_names)?;
}
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)?
self.compile_async_generator_body(&param_names, body_stmts, ctx, own_strict)?
} else if fd.generator {
self.compile_generator_body(&param_names, body_stmts, ctx)?
self.compile_generator_body(&param_names, body_stmts, ctx, own_strict)?
} else if fd.r#async {
self.compile_async_body(&param_names, body_stmts, ctx, false, false)?
self.compile_async_body(&param_names, body_stmts, ctx, false, false, own_strict)?
} else {
self.compile_function_body(&param_names, body_stmts, ctx, false, false)?
self.compile_function_body(&param_names, body_stmts, ctx, false, false, own_strict)?
};
sub_module.function_name = Some(name.clone());
ctx.nested.push(sub_module);