feat: async-generator 语义(async function*),yield/await 共存 + next 返回 Promise

- emit 识别 generator+async 组合,模块同时标记 is_generator/is_async
- 新增 AsyncGeneratorState:帧快照 + 请求队列 + 当前请求
- next/return/throw 返回 Promise,请求入队逐条处理
- YIELD 让出经 promise unwrap 后交付(yield rejected promise 关闭生成器)
- AWAIT 挂起保留当前请求,微任务恢复后继续执行
- %AsyncGeneratorPrototype% / %AsyncGeneratorFunction.prototype% 内建
- session GC / promote 支持异步生成器状态盒
- 普通 async 函数嵌套调用隔离外层异步生成器上下文
This commit is contained in:
2026-08-10 01:52:03 +08:00
parent 85c192a747
commit 5ced83e8c0
15 changed files with 1285 additions and 40 deletions
+2 -1
View File
@@ -7,9 +7,10 @@
//! 核心入口为 [`vm::Vm`];`VmPool` 负责 VM 实例的复用;`session_gc` 提供
//! session 内存回收;`bindings` 把内置对象绑定到每个 session 的 global 上。
mod async_func;
mod async_generator;
/// 内置对象绑定模块:向 session 的 global 对象安装 Object/Array/... 及各原型。
pub mod bindings;
mod async_func;
mod dispatch;
mod generator;
mod ic_helper;