mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
fix bug
This commit is contained in:
@@ -364,7 +364,7 @@ export const eval_modules = (
|
|||||||
let is_found_deferred_call = false
|
let is_found_deferred_call = false
|
||||||
let i
|
let i
|
||||||
|
|
||||||
let {calltree, logs} = run()
|
let {calltree, modules, logs} = run()
|
||||||
|
|
||||||
is_recording_deferred_calls = false
|
is_recording_deferred_calls = false
|
||||||
if(found_call == null && deferred_calls != null) {
|
if(found_call == null && deferred_calls != null) {
|
||||||
@@ -394,6 +394,7 @@ export const eval_modules = (
|
|||||||
deferred_call_index: i,
|
deferred_call_index: i,
|
||||||
calltree,
|
calltree,
|
||||||
call,
|
call,
|
||||||
|
modules,
|
||||||
logs,
|
logs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -706,6 +707,7 @@ export const eval_modules = (
|
|||||||
deferred_call_index,
|
deferred_call_index,
|
||||||
calltree,
|
calltree,
|
||||||
call,
|
call,
|
||||||
|
modules,
|
||||||
logs,
|
logs,
|
||||||
} = actions.find_call(loc, deferred_calls)
|
} = actions.find_call(loc, deferred_calls)
|
||||||
return {
|
return {
|
||||||
@@ -715,6 +717,7 @@ export const eval_modules = (
|
|||||||
// TODO: `call` does not have `code` property here. Currently it is
|
// TODO: `call` does not have `code` property here. Currently it is
|
||||||
// worked around by callers. Refactor
|
// worked around by callers. Refactor
|
||||||
call,
|
call,
|
||||||
|
modules,
|
||||||
logs,
|
logs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
test/test.js
24
test/test.js
@@ -1524,6 +1524,30 @@ const y = x()`
|
|||||||
assert_equal(active.index, edited.indexOf('() =>'))
|
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', () => {
|
test('edit toplevel', () => {
|
||||||
const code = `
|
const code = `
|
||||||
const x = () => {
|
const x = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user