mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -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 {is_eq, find_error_origin_node} from './ast_utils.js'
|
||||||
import {find_node, find_leaf, ancestry_inc} from './ast_utils.js'
|
import {find_node, find_leaf, ancestry_inc} from './ast_utils.js'
|
||||||
import {color} from './color.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 => ({
|
export const pp_calltree = tree => ({
|
||||||
id: tree.id,
|
id: tree.id,
|
||||||
@@ -176,7 +176,11 @@ const replace_calltree_node = (root, node, replacement) => {
|
|||||||
|
|
||||||
const expand_calltree_node = (state, node) => {
|
const expand_calltree_node = (state, node) => {
|
||||||
if(node.has_more_children) {
|
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 {
|
return {
|
||||||
state: {...state,
|
state: {...state,
|
||||||
calltree: replace_calltree_node(state.calltree, node, next_node)
|
calltree: replace_calltree_node(state.calltree, node, next_node)
|
||||||
@@ -594,7 +598,11 @@ export const find_call = (state, index) => {
|
|||||||
|
|
||||||
if(call != null) {
|
if(call != null) {
|
||||||
if(call.has_more_children) {
|
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(
|
next_calltree = replace_calltree_node(
|
||||||
state.calltree,
|
state.calltree,
|
||||||
call,
|
call,
|
||||||
@@ -605,7 +613,12 @@ export const find_call = (state, index) => {
|
|||||||
next_calltree = state.calltree
|
next_calltree = state.calltree
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if(find_result == null) {
|
||||||
return add_calltree_node_by_loc(
|
return add_calltree_node_by_loc(
|
||||||
// Remove active_calltree_node
|
// Remove active_calltree_node
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const apply_eval_result = (state, eval_result) => {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
calltree: make_calltree(eval_result.calltree, null),
|
calltree: make_calltree(eval_result.calltree, null),
|
||||||
calltree_actions: eval_result.calltree_actions,
|
eval_cxt: eval_result.eval_cxt,
|
||||||
logs: {
|
logs: {
|
||||||
logs: collect_logs(eval_result.logs, eval_result.calltree),
|
logs: collect_logs(eval_result.logs, eval_result.calltree),
|
||||||
log_position: null
|
log_position: null
|
||||||
@@ -84,7 +84,7 @@ const run_code = (s, dirty_files) => {
|
|||||||
// Shows that calltree is brand new and requires entire rerender
|
// Shows that calltree is brand new and requires entire rerender
|
||||||
calltree_changed_token: {},
|
calltree_changed_token: {},
|
||||||
|
|
||||||
calltree_actions: null,
|
eval_cxt: null,
|
||||||
logs: null,
|
logs: null,
|
||||||
current_calltree_node: null,
|
current_calltree_node: null,
|
||||||
active_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