feat: async/await 语法支持(AWAIT 帧快照挂起/恢复 + 微任务驱动 + AsyncFunction intrinsics)

This commit is contained in:
爱特每羊队
2026-08-09 22:02:15 +08:00
parent dcbe3d9320
commit 0d9e6eabc9
28 changed files with 1055 additions and 28 deletions
+7 -1
View File
@@ -41,7 +41,11 @@ impl Emitter {
let body_stmts = &arrow.body.statements;
let is_expr_body = arrow.expression;
let mut sub_module = self.compile_function_body(&param_names, body_stmts, ctx, is_expr_body, true)?;
let mut sub_module = if arrow.r#async {
self.compile_async_body(&param_names, body_stmts, ctx, is_expr_body, true)?
} else {
self.compile_function_body(&param_names, body_stmts, ctx, is_expr_body, true)?
};
sub_module.is_arrow = true;
ctx.nested.push(sub_module);
@@ -78,6 +82,8 @@ impl Emitter {
let mut sub_module = if fe.generator {
self.compile_generator_body(&param_names, body_stmts, ctx)?
} else if fe.r#async {
self.compile_async_body(&param_names, body_stmts, ctx, false, false)?
} else {
self.compile_function_body(&param_names, body_stmts, ctx, false, false)?
};