mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 03:01:12 +08:00
feat: for-await-of + Symbol.asyncIterator + AsyncFromSyncIterator
This commit is contained in:
@@ -782,6 +782,8 @@ impl Vm {
|
||||
Some(6)
|
||||
} else if std::ptr::eq(ptr, world.sym_match_all.as_ptr()) {
|
||||
Some(7)
|
||||
} else if std::ptr::eq(ptr, world.sym_async_iterator.as_ptr()) {
|
||||
Some(8)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -1520,6 +1522,28 @@ impl Vm {
|
||||
self.dispatch_for_of_close()?;
|
||||
}
|
||||
|
||||
OpCode::FOR_AWAIT_OF_INIT => {
|
||||
self.dispatch_for_await_of_init(a)?;
|
||||
}
|
||||
|
||||
OpCode::FOR_AWAIT_OF_NEXT => {
|
||||
self.dispatch_for_await_of_next(rd)?;
|
||||
}
|
||||
|
||||
OpCode::FOR_AWAIT_OF_DONE => {
|
||||
self.dispatch_for_await_of_done(rd, a)?;
|
||||
}
|
||||
|
||||
OpCode::FOR_AWAIT_OF_CLOSE => {
|
||||
self.dispatch_for_await_of_close()?;
|
||||
// 异步 IteratorClose 可能经 await 挂起(return() 的 promise),
|
||||
// 挂起时须像 AWAIT 一样让内嵌 dispatch 返回,由恢复方快照状态。
|
||||
if self.async_suspended || self.async_gen_suspended {
|
||||
self.profiling.set_instruction_count(steps);
|
||||
return Ok(JsValue::undefined());
|
||||
}
|
||||
}
|
||||
|
||||
OpCode::REST_OBJECT => {
|
||||
self.dispatch_rest_object(rd, a, b)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user