This commit is contained in:
Dmitry Vasilev
2023-11-23 14:51:10 +08:00
parent 9b92302d88
commit 28332b874e
8 changed files with 25 additions and 25 deletions

View File

@@ -216,7 +216,7 @@ const replace_calltree_node = (root, node, replacement) => {
const expand_calltree_node = (state, node) => {
if(node.has_more_children) {
const next_node = eval_expand_calltree_node(
state.eval_cxt,
state.rt_cxt,
state.parse_result,
node
)

View File

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

View File

@@ -40,7 +40,7 @@ export class IO_Trace {
const items = state.io_trace ?? []
// Number of items that were used during execution
const used_count = state.eval_cxt.io_trace_index ?? items.length
const used_count = state.rt_cxt.io_trace_index ?? items.length
for(let i = 0; i < items.length; i++) {
const item = items[i]

2
src/effects.js vendored
View File

@@ -223,7 +223,7 @@ export const apply_side_effects = (prev, next, ui) => {
if(
prev.io_trace != next.io_trace
||
prev.eval_cxt?.io_trace_index != next.eval_cxt.io_trace_index
prev.rt_cxt?.io_trace_index != next.rt_cxt.io_trace_index
) {
ui.render_io_trace(next)
}

View File

@@ -480,10 +480,10 @@ export const eval_modules = (
return {
modules: result.modules,
logs: result.logs,
eval_cxt: result.eval_cxt,
rt_cxt: result.rt_cxt,
calltree,
calltree_node_by_loc: result.calltree_node_by_loc,
io_trace: result.eval_cxt.io_trace,
io_trace: result.rt_cxt.io_trace,
}
}

View File

@@ -255,17 +255,17 @@ export const with_code_execution = (action, state = get_state()) => {
call toJSON(), which can call trigger deferred call (see lodash.js lazy
chaining)
*/
if(state.eval_cxt != null) {
state.eval_cxt.is_recording_deferred_calls = false
state.eval_cxt.skip_save_ct_node_for_path = true
if(state.rt_cxt != null) {
state.rt_cxt.is_recording_deferred_calls = false
state.rt_cxt.skip_save_ct_node_for_path = true
}
try {
return action()
} finally {
if(state.eval_cxt != null) {
state.eval_cxt.is_recording_deferred_calls = true
state.eval_cxt.skip_save_ct_node_for_path = false
if(state.rt_cxt != null) {
state.rt_cxt.is_recording_deferred_calls = true
state.rt_cxt.skip_save_ct_node_for_path = false
}
}
}

View File

@@ -122,7 +122,7 @@ const do_run = function*(module_fns, cxt, io_trace){
modules: cxt.modules,
calltree,
logs: _logs,
eval_cxt: cxt,
rt_cxt: cxt,
calltree_node_by_loc,
}
}
@@ -130,9 +130,9 @@ const do_run = function*(module_fns, cxt, io_trace){
export const run = gen_to_promise(function*(module_fns, cxt, io_trace) {
const result = yield* do_run(module_fns, cxt, io_trace)
if(result.eval_cxt.io_trace_is_replay_aborted) {
if(result.rt_cxt.io_trace_is_replay_aborted) {
// TODO test next line
result.eval_cxt.is_recording_deferred_calls = false
result.rt_cxt.is_recording_deferred_calls = false
// run again without io trace
return yield* do_run(module_fns, cxt, null)