Generate a better error if a function operand is invalid.
This commit is contained in:
parent
efc923acb4
commit
72c09cc0bf
1 changed files with 1 additions and 2 deletions
|
|
@ -93,12 +93,11 @@ value_t expr_t::op_t::calc(scope_t& scope)
|
||||||
call_args.set_args(right()->calc(scope));
|
call_args.set_args(right()->calc(scope));
|
||||||
|
|
||||||
ptr_op_t func = left();
|
ptr_op_t func = left();
|
||||||
string name;
|
|
||||||
|
|
||||||
assert(func->kind == IDENT);
|
assert(func->kind == IDENT);
|
||||||
func = func->left();
|
func = func->left();
|
||||||
|
|
||||||
if (func->kind != FUNCTION)
|
if (! func || func->kind != FUNCTION)
|
||||||
throw_(calc_error, "Calling non-function");
|
throw_(calc_error, "Calling non-function");
|
||||||
|
|
||||||
return func->as_function()(call_args);
|
return func->as_function()(call_args);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue