[qfcc] Make is_function_call a little more useful

It can (and must) be used one level higher as it checks that the
expression is a block and that its result expression is call branch
expression.
This commit is contained in:
Bill Currie 2022-02-05 18:55:36 +09:00
parent eee6744656
commit 084c2ccb1f
2 changed files with 6 additions and 2 deletions

View file

@ -1796,6 +1796,10 @@ has_function_call (expr_t *e)
int
is_function_call (expr_t *e)
{
if (e->type != ex_block || !e->e.block.is_call) {
return 0;
}
e = e->e.block.result;
return e->type == ex_branch && e->e.branch.type == pr_branch_call;
}

View file

@ -249,8 +249,8 @@ message_expr (expr_t *receiver, keywordarg_t *message)
if (call->type == ex_error)
return receiver;
if (!is_function_call (call->e.block.result)) {
internal_error (call, "unexpected block result type");
if (!is_function_call (call)) {
internal_error (call, "unexpected call expression type");
}
call->e.block.result->e.branch.ret_type = return_type;
return call;