mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
show arguments as dictionary with names, not as array
This commit is contained in:
@@ -300,25 +300,39 @@ const jump_calltree_node = (_state, _current_calltree_node) => {
|
|||||||
with_location.active_calltree_node.id,
|
with_location.active_calltree_node.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
return {...with_selected_calltree_node,
|
let value_explorer
|
||||||
value_explorer: next.current_calltree_node.toplevel
|
|
||||||
? null
|
if(next.current_calltree_node.toplevel) {
|
||||||
: {
|
value_explorer = null
|
||||||
|
} else {
|
||||||
|
|
||||||
|
const args = show_body
|
||||||
|
? active_frame(with_selected_calltree_node)
|
||||||
|
// function args node
|
||||||
|
.children[0]
|
||||||
|
.result
|
||||||
|
.value
|
||||||
|
: current_calltree_node.args
|
||||||
|
|
||||||
|
value_explorer = {
|
||||||
index: loc.index,
|
index: loc.index,
|
||||||
result: {
|
result: {
|
||||||
ok: true,
|
ok: true,
|
||||||
value: current_calltree_node.ok
|
value: current_calltree_node.ok
|
||||||
? {
|
? {
|
||||||
'*arguments*': current_calltree_node.args,
|
'*arguments*': args,
|
||||||
'*return*': current_calltree_node.value,
|
'*return*': current_calltree_node.value,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
'*arguments*': current_calltree_node.args,
|
'*arguments*': args,
|
||||||
'*throws*': current_calltree_node.error,
|
'*throws*': current_calltree_node.error,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {...with_selected_calltree_node,
|
||||||
|
value_explorer,
|
||||||
selection_state: show_body
|
selection_state: show_body
|
||||||
? null
|
? null
|
||||||
: {node: callsite_node}
|
: {node: callsite_node}
|
||||||
|
|||||||
12
test/test.js
12
test/test.js
@@ -2120,6 +2120,18 @@ const y = x()`
|
|||||||
assert_equal(map_expanded.children.length, 3)
|
assert_equal(map_expanded.children.length, 3)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
test('value_explorer arguments', () => {
|
||||||
|
const i = test_initial_state(`
|
||||||
|
function foo(x, {y}) {
|
||||||
|
}
|
||||||
|
|
||||||
|
foo(1, {y: 2})
|
||||||
|
`)
|
||||||
|
const expanded = COMMANDS.calltree.click(i, root_calltree_node(i).children[0].id)
|
||||||
|
const args = expanded.value_explorer.result.value['*arguments*']
|
||||||
|
assert_equal(args, {x: 1, y: 2})
|
||||||
|
}),
|
||||||
|
|
||||||
test('click native calltree node', () => {
|
test('click native calltree node', () => {
|
||||||
const s = test_initial_state(`Object.fromEntries([])`)
|
const s = test_initial_state(`Object.fromEntries([])`)
|
||||||
const index = 0 // Where call starts
|
const index = 0 // Where call starts
|
||||||
|
|||||||
Reference in New Issue
Block a user