mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-24 18:51:13 +08:00
refactor: 函数 strict 标志入 IR/编译/缓存链(零行为地基)
This commit is contained in:
@@ -40,9 +40,23 @@ impl Emitter {
|
||||
let is_expr_body = arrow.expression;
|
||||
|
||||
let mut sub_module = if arrow.r#async {
|
||||
self.compile_async_body(¶m_names, body_stmts, ctx, is_expr_body, true)?
|
||||
self.compile_async_body(
|
||||
¶m_names,
|
||||
body_stmts,
|
||||
ctx,
|
||||
is_expr_body,
|
||||
true,
|
||||
arrow.has_use_strict_directive(),
|
||||
)?
|
||||
} else {
|
||||
self.compile_function_body(¶m_names, body_stmts, ctx, is_expr_body, true)?
|
||||
self.compile_function_body(
|
||||
¶m_names,
|
||||
body_stmts,
|
||||
ctx,
|
||||
is_expr_body,
|
||||
true,
|
||||
arrow.has_use_strict_directive(),
|
||||
)?
|
||||
};
|
||||
sub_module.is_arrow = true;
|
||||
|
||||
@@ -83,14 +97,15 @@ impl Emitter {
|
||||
|
||||
let body_stmts: &[Statement] = if let Some(body) = &fe.body { &body.statements } else { &[] };
|
||||
|
||||
let own_strict = fe.has_use_strict_directive();
|
||||
let mut sub_module = if fe.generator && fe.r#async {
|
||||
self.compile_async_generator_body(¶m_names, body_stmts, ctx)?
|
||||
self.compile_async_generator_body(¶m_names, body_stmts, ctx, own_strict)?
|
||||
} else if fe.generator {
|
||||
self.compile_generator_body(¶m_names, body_stmts, ctx)?
|
||||
self.compile_generator_body(¶m_names, body_stmts, ctx, own_strict)?
|
||||
} else if fe.r#async {
|
||||
self.compile_async_body(¶m_names, body_stmts, ctx, false, false)?
|
||||
self.compile_async_body(¶m_names, body_stmts, ctx, false, false, own_strict)?
|
||||
} else {
|
||||
self.compile_function_body(¶m_names, body_stmts, ctx, false, false)?
|
||||
self.compile_function_body(¶m_names, body_stmts, ctx, false, false, own_strict)?
|
||||
};
|
||||
if let Some(id) = &fe.id {
|
||||
sub_module.function_name = Some(id.name.to_string());
|
||||
|
||||
Reference in New Issue
Block a user