fix move_cursor before eval finished

This commit is contained in:
Dmitry Vasilev
2023-01-03 02:01:40 +08:00
parent 32e85f6d24
commit bc8ae5a0ba
2 changed files with 6 additions and 6 deletions

View File

@@ -742,8 +742,8 @@ const move_cursor = (s, index) => {
return {state: with_cursor}
}
if(s.loading_external_imports_state != null) {
// Code will be executed when imports will load, do not do it right now
if(s.loading_external_imports_state != null || s.eval_modules_state != null) {
// Code will be executed when imports will load, do not do it right now
return {state: with_cursor}
}

View File

@@ -2943,12 +2943,12 @@ const y = x()`
)
}),
/* TODO
test('async/await move_cursor bug', async () => {
const i = await test_initial_state_async(`
test('async/await move_cursor before code evaluated', async () => {
const i = test_initial_state(`
await new Promise(resolve => globalThis.setTimeout(resolve, 1))
`)
const moved = COMMANDS.move_cursor(i, 0)
// No assertion, must not throw
}),
*/
]