record constructor calls in calltree

This commit is contained in:
Dmitry Vasilev
2022-12-16 18:23:55 +08:00
parent f2c906687e
commit f062056ad1
5 changed files with 85 additions and 27 deletions

View File

@@ -984,11 +984,20 @@ const new_expr = if_ok(
array_element,
)
]),
({value, ...node}) => ({
...node,
type: 'new',
children: [value[1], ...value[2].value],
})
({value, ...node}) => {
const {value: args, ..._call_args} = value[2]
const call_args = {
..._call_args,
children: args,
not_evaluatable: args.length == 0,
type: 'call_args',
}
return {
...node,
type: 'new',
children: [value[1], call_args],
}
}
)
const primary = if_fail(
@@ -1384,7 +1393,7 @@ const update_children_not_rec = (node, children = node.children) => {
expr: children[0]
}
} else if(node.type == 'new') {
return {...node, constructor: children[0], args: children.slice(1)}
return {...node, constructor: children[0], args: children[1]}
} else if(node.type == 'grouping') {
return {...node, expr: children[0]}
} else if(node.type == 'return') {