mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-14 05:14:28 -08:00
WIP
This commit is contained in:
13
src/cmd.js
13
src/cmd.js
@@ -201,10 +201,18 @@ const external_imports_loaded = (
|
|||||||
toplevel = false
|
toplevel = false
|
||||||
}
|
}
|
||||||
|
|
||||||
return modules_evaluated(state, result, node, toplevel)
|
if(result.then != null) {
|
||||||
|
return {...state,
|
||||||
|
eval_modules_state: {
|
||||||
|
promise: result, node, toplevel,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return eval_modules_finished(state, result, node, toplevel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const modules_evaluated = (state, result, node, toplevel) => {
|
const eval_modules_finished = (state, result, node, toplevel) => {
|
||||||
const next = apply_eval_result(state, result)
|
const next = apply_eval_result(state, result)
|
||||||
|
|
||||||
let active_calltree_node
|
let active_calltree_node
|
||||||
@@ -837,6 +845,7 @@ export const COMMANDS = {
|
|||||||
move_cursor,
|
move_cursor,
|
||||||
eval_selection,
|
eval_selection,
|
||||||
external_imports_loaded,
|
external_imports_loaded,
|
||||||
|
eval_modules_finished,
|
||||||
on_deferred_call,
|
on_deferred_call,
|
||||||
calltree: calltree_commands,
|
calltree: calltree_commands,
|
||||||
}
|
}
|
||||||
|
|||||||
7
src/effects.js
vendored
7
src/effects.js
vendored
@@ -176,6 +176,13 @@ export const render_common_side_effects = async (prev, next, command, ui) => {
|
|||||||
load_external_imports(next)
|
load_external_imports(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(prev.eval_modules_state != next.eval_modules_state) {
|
||||||
|
const s = next.eval_modules_state
|
||||||
|
s.promise.then(result => {
|
||||||
|
exec('eval_modules_finished', result, s.node, s.toplevel)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if(prev.parse_result != next.parse_result) {
|
if(prev.parse_result != next.parse_result) {
|
||||||
render_parse_result(ui, next)
|
render_parse_result(ui, next)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2589,7 +2589,7 @@ const y = x()`
|
|||||||
assert_equal(get_deferred_calls(result), null)
|
assert_equal(get_deferred_calls(result), null)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
test_only('async/await', () => {
|
test('async/await', () => {
|
||||||
const code = `
|
const code = `
|
||||||
const x = async () => 123
|
const x = async () => 123
|
||||||
const y = async () => await x()
|
const y = async () => await x()
|
||||||
|
|||||||
Reference in New Issue
Block a user