mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
fix step into native fn
This commit is contained in:
12
src/cmd.js
12
src/cmd.js
@@ -15,6 +15,7 @@ import {
|
|||||||
initial_calltree_node, default_expand_path, toggle_expanded, active_frame,
|
initial_calltree_node, default_expand_path, toggle_expanded, active_frame,
|
||||||
find_call, set_active_calltree_node,
|
find_call, set_active_calltree_node,
|
||||||
set_cursor_position, current_cursor_position, set_location,
|
set_cursor_position, current_cursor_position, set_location,
|
||||||
|
is_native_fn,
|
||||||
} from './calltree.js'
|
} from './calltree.js'
|
||||||
|
|
||||||
const collect_logs = (logs, call) => {
|
const collect_logs = (logs, call) => {
|
||||||
@@ -344,6 +345,17 @@ const step_into = (state, index) => {
|
|||||||
active_frame(state),
|
active_frame(state),
|
||||||
index
|
index
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(is_native_fn(calltree_node)) {
|
||||||
|
return {
|
||||||
|
state,
|
||||||
|
effects: {
|
||||||
|
type: 'set_status',
|
||||||
|
args: ['Cannot step into: function is either builtin or from external lib']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!ok){
|
if(!ok){
|
||||||
return {state, effects: {type: 'set_status', args: [message]}}
|
return {state, effects: {type: 'set_status', args: [message]}}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
13
test/test.js
13
test/test.js
@@ -1650,6 +1650,19 @@ export const tests = [
|
|||||||
assert_equal(cn.index, code.indexOf('() => x()'))
|
assert_equal(cn.index, code.indexOf('() => x()'))
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
test('step_into native bug', () => {
|
||||||
|
const code = `Object()`
|
||||||
|
const initial = test_initial_state(code)
|
||||||
|
const {state, effects} = COMMANDS.step_into(initial, 0)
|
||||||
|
assert_equal(initial == state, true)
|
||||||
|
assert_equal(effects, {
|
||||||
|
"type": "set_status",
|
||||||
|
"args": [
|
||||||
|
"Cannot step into: function is either builtin or from external lib"
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
|
||||||
test('coloring', () => {
|
test('coloring', () => {
|
||||||
const code = `
|
const code = `
|
||||||
const x = () => {
|
const x = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user