async calls find calls WIP

This commit is contained in:
Dmitry Vasilev
2022-11-23 18:03:00 +08:00
parent 41ebe9d96e
commit 7fa3e78db3
3 changed files with 102 additions and 4 deletions

View File

@@ -630,7 +630,10 @@ export const find_call = (state, index) => {
}
const loc = {index: node.index, module: state.current_module}
const {calltree, call} = state.calltree_actions.find_call(loc)
const {calltree, call} = state.calltree_actions.find_call(
loc,
get_async_calls(state)
)
if(call == null) {
return add_calltree_node_by_loc(
// Remove active_calltree_node

View File

@@ -310,9 +310,17 @@ export const eval_modules = (
}
}
const find_call = (location) => {
const find_call = (location, async_calls) => {
searched_location = location
const {modules, calltree} = run()
if(found_call == null && async_calls != null) {
for(let c of async_calls) {
c.fn.apply(c.context, c.args)
if(found_call != null) {
break
}
}
}
searched_location = null
const call = found_call
found_call = null
@@ -554,8 +562,8 @@ export const eval_modules = (
const expanded = actions.expand_calltree_node(node)
return assign_code(parse_result.modules, expanded)
},
find_call: (loc) => {
const {modules, calltree, call} = actions.find_call(loc)
find_call: (loc, async_calls) => {
const {modules, calltree, call} = actions.find_call(loc, async_calls)
return {
calltree: assign_code(parse_result.modules, calltree),
// TODO: `call` does not have `code` property here. Currently it is