Improve error reporting of nested function calls
This commit is contained in:
parent
6ddd935e4a
commit
2a41649584
1 changed files with 8 additions and 7 deletions
15
src/op.cc
15
src/op.cc
|
|
@ -537,13 +537,13 @@ value_t expr_t::op_t::calc_call(scope_t& scope, ptr_op_t * locus,
|
||||||
ptr_op_t func = left();
|
ptr_op_t func = left();
|
||||||
string name = func->is_ident() ? func->as_ident() : "<value expr>";
|
string name = func->is_ident() ? func->as_ident() : "<value expr>";
|
||||||
|
|
||||||
|
func = find_definition(func, scope, locus, depth);
|
||||||
|
|
||||||
|
call_scope_t call_args(scope, locus, depth + 1);
|
||||||
|
if (has_right())
|
||||||
|
call_args.set_args(split_cons_expr(right()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
func = find_definition(func, scope, locus, depth);
|
|
||||||
|
|
||||||
call_scope_t call_args(scope, locus, depth + 1);
|
|
||||||
if (has_right())
|
|
||||||
call_args.set_args(split_cons_expr(right()));
|
|
||||||
|
|
||||||
if (func->is_function()) {
|
if (func->is_function()) {
|
||||||
return func->as_function()(call_args);
|
return func->as_function()(call_args);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -552,7 +552,8 @@ value_t expr_t::op_t::calc_call(scope_t& scope, ptr_op_t * locus,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::exception&) {
|
catch (const std::exception&) {
|
||||||
add_error_context(_("While calling function '%1':" << name));
|
add_error_context(_("While calling function '%1 %2':" << name
|
||||||
|
<< call_args.args));
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue