async calls WIP

This commit is contained in:
Dmitry Vasilev
2022-10-25 02:29:59 +08:00
parent 7c9c74988d
commit 1d1215b718
5 changed files with 98 additions and 12 deletions

View File

@@ -185,7 +185,8 @@ const do_external_imports_loaded = (
const result = eval_modules(
state.parse_result.modules,
state.parse_result.sorted,
external_imports
external_imports,
state.on_async_call,
)
const next = apply_eval_result(state, result)
@@ -208,6 +209,7 @@ const do_external_imports_loaded = (
state.parse_result.modules,
state.parse_result.sorted,
external_imports,
state.on_async_call,
{index: node.index, module: state.current_module},
)
@@ -737,6 +739,10 @@ const move_cursor = (s, index) => {
return do_move_cursor(state, index)
}
const on_async_call = (state, ...args) => {
console.log('on_async_call', state, args)
}
const load_dir = (state, dir) => {
const collect_files = dir => dir.kind == 'file'
? [dir]
@@ -792,5 +798,6 @@ export const COMMANDS = {
move_cursor,
eval_selection,
external_imports_loaded,
on_async_call,
calltree: calltree_commands,
}