This commit is contained in:
Dmitry Vasilev
2022-12-28 00:36:00 +08:00
parent 04c47a44e8
commit cbda099c7f
2 changed files with 28 additions and 1 deletions

View File

@@ -364,7 +364,7 @@ export const eval_modules = (
let is_found_deferred_call = false
let i
let {calltree, logs} = run()
let {calltree, modules, logs} = run()
is_recording_deferred_calls = false
if(found_call == null && deferred_calls != null) {
@@ -394,6 +394,7 @@ export const eval_modules = (
deferred_call_index: i,
calltree,
call,
modules,
logs,
}
}
@@ -706,6 +707,7 @@ export const eval_modules = (
deferred_call_index,
calltree,
call,
modules,
logs,
} = actions.find_call(loc, deferred_calls)
return {
@@ -715,6 +717,7 @@ export const eval_modules = (
// TODO: `call` does not have `code` property here. Currently it is
// worked around by callers. Refactor
call,
modules,
logs,
}
}

View File

@@ -1524,6 +1524,30 @@ const y = x()`
assert_equal(active.index, edited.indexOf('() =>'))
}),
test('edit function modules bug', () => {
const s1 = test_initial_state({
'' : `
import {x} from 'x.js'
const fn = () => {
}
`,
'x.js': `
export const x = 1
`
})
const edited = `
import {x} from 'x.js'
const fn = () => {
1
}
`
const {state: s2} = COMMANDS.input(s1, edited, edited.indexOf('1'))
const s3 = COMMANDS.move_cursor(s2, edited.indexOf('import'))
assert_equal(s3.effects.args[0].result.value.x, 1)
}),
test('edit toplevel', () => {
const code = `
const x = () => {