mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
WIP
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
891
src/eval.js
891
src/eval.js
File diff suppressed because it is too large
Load Diff
0
src/runtime.js
Normal file
0
src/runtime.js
Normal file
Reference in New Issue
Block a user