ITADN

Promises hang

#942OpenChALkeR 创建于 2026-02-09
C
ChALkeRcommented
```js async function main() { await Promise.resolve().then(() => { var Context = class { #a; }; print('One') new Context(); print('Two') }) for (let j = 0; j < 10; j++) { const promise = Promise.resolve(); print('start ' + j) for (let i = 0; i < 10000; i++) await promise; print('stop ' + j) } } main() ``` It hangs between 'start' and 'stop'. And that one `new Context()` is for some reason significant. This is also reproducible with a chain of thens and a single await, or awaiting a literal.
0 条评论