This commit is contained in:
Dmitry Vasilev
2023-02-04 22:37:35 +08:00
parent f37bfd4627
commit 28d5776219
4 changed files with 437 additions and 479 deletions

View File

@@ -2,7 +2,7 @@ import {map_accum, map_find, map_object, stringify, findLast} from './utils.js'
import {is_eq, find_error_origin_node} from './ast_utils.js'
import {find_node, find_leaf, ancestry_inc} from './ast_utils.js'
import {color} from './color.js'
import {eval_frame} from './eval.js'
import {eval_frame, eval_expand_calltree_node, eval_find_call} from './eval.js'
export const pp_calltree = tree => ({
id: tree.id,
@@ -176,7 +176,11 @@ const replace_calltree_node = (root, node, replacement) => {
const expand_calltree_node = (state, node) => {
if(node.has_more_children) {
const next_node = state.calltree_actions.expand_calltree_node(node)
const next_node = eval_expand_calltree_node(
state.eval_cxt,
state.parse_result,
node
)
return {
state: {...state,
calltree: replace_calltree_node(state.calltree, node, next_node)
@@ -594,7 +598,11 @@ export const find_call = (state, index) => {
if(call != null) {
if(call.has_more_children) {
active_calltree_node = state.calltree_actions.expand_calltree_node(call)
active_calltree_node = eval_expand_calltree_node(
state.eval_cxt,
state.parse_result,
call
)
next_calltree = replace_calltree_node(
state.calltree,
call,
@@ -605,7 +613,12 @@ export const find_call = (state, index) => {
next_calltree = state.calltree
}
} else {
const find_result = state.calltree_actions.find_call(state.calltree, loc)
const find_result = eval_find_call(
state.eval_cxt,
state.parse_result,
state.calltree,
loc
)
if(find_result == null) {
return add_calltree_node_by_loc(
// Remove active_calltree_node

View File

@@ -46,7 +46,7 @@ const apply_eval_result = (state, eval_result) => {
return {
...state,
calltree: make_calltree(eval_result.calltree, null),
calltree_actions: eval_result.calltree_actions,
eval_cxt: eval_result.eval_cxt,
logs: {
logs: collect_logs(eval_result.logs, eval_result.calltree),
log_position: null
@@ -84,7 +84,7 @@ const run_code = (s, dirty_files) => {
// Shows that calltree is brand new and requires entire rerender
calltree_changed_token: {},
calltree_actions: null,
eval_cxt: null,
logs: null,
current_calltree_node: null,
active_calltree_node: null,

File diff suppressed because it is too large Load Diff

0
src/runtime.js Normal file
View File