mirror of
https://github.com/swc-project/swc.git
synced 2024-12-21 04:32:01 +03:00
72c9f4373a
swc_ecma_parser: - Fix panic from span assertion. (#2040) swc_ecma_transforms_compat: - Fix handling of `await for`. (#1918) swc_ecma_transforms_base: - Allow using decorator metadata even if `reflect-metadata` is not imported. (#1362)
28 lines
582 B
JavaScript
28 lines
582 B
JavaScript
let resolve;
|
|
let promise = new Promise((r) => (resolve = r));
|
|
let iterable = {
|
|
[Symbol.asyncIterator]() {
|
|
return {
|
|
next() {
|
|
return promise;
|
|
},
|
|
};
|
|
},
|
|
};
|
|
|
|
(async () => {
|
|
for await (let value of iterable) {
|
|
console.log(value);
|
|
}
|
|
})();
|
|
|
|
(async function () {
|
|
resolve({ value: 0, done: false });
|
|
promise = new Promise((r) => (resolve = r));
|
|
|
|
await null;
|
|
resolve({ value: 1, done: false });
|
|
promise = new Promise((r) => (resolve = r));
|
|
|
|
resolve({ value: undefined, done: true });
|
|
})(); |