aboutsummaryrefslogtreecommitdiff
path: root/src/ssa
diff options
context:
space:
mode:
Diffstat (limited to 'src/ssa')
-rw-r--r--src/ssa/ssa.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/ssa/ssa.c b/src/ssa/ssa.c
index 13f19a9..d76ad28 100644
--- a/src/ssa/ssa.c
+++ b/src/ssa/ssa.c
@@ -640,7 +640,7 @@ static CHECK_RESULT SsaRegister funcdecl_generate_ssa(FunctionDecl *self, SsaCom
return 0;
}
-static CHECK_RESULT SsaRegister funccall_generate_ssa(FunctionCall *self, AstResolveData *resolve_data, SsaCompilerContext *context) {
+static CHECK_RESULT SsaRegister funccall_generate_ssa(FunctionCall *self, SsaCompilerContext *context) {
SsaRegister reg;
FunctionSignature *func_sig;
FunctionDecl *func_decl;
@@ -649,12 +649,18 @@ static CHECK_RESULT SsaRegister funccall_generate_ssa(FunctionCall *self, AstRes
context->import_index = 0;
throw_if_error(ssa_get_unique_reg(context->ssa, &reg));
- assert(resolve_data->type.type == RESOLVED_TYPE_FUNC_SIG);
- func_sig = resolve_data->type.value.func_sig;
+ assert(self->func.resolved_var.type == NAMED_OBJECT_LHS_EXPR);
+ func_lhs_expr = self->func.resolved_var.value.lhs_expr;
+ if(func_lhs_expr->type.type == VARIABLE_TYPE_SIGNATURE) {
+ func_sig = func_lhs_expr->type.value.signature;
+ } else if(func_lhs_expr->type.type == VARIABLE_TYPE_VARIABLE) {
+ AstResolveData *resolve_data = func_lhs_expr->type.value.variable->resolved_var.resolve_data;
+ assert(resolve_data->type.type == RESOLVED_TYPE_FUNC_SIG);
+ func_sig = resolve_data->type.value.func_sig;
+ } else {
+ assert(bool_false);
+ }
func_decl = func_sig->func_decl;
- func_lhs_expr = NULL;
- if(self->func.resolved_var.type == NAMED_OBJECT_LHS_EXPR)
- func_lhs_expr = self->func.resolved_var.value.lhs_expr;
/* Push return arguments */
{
@@ -869,7 +875,7 @@ static CHECK_RESULT SsaRegister ast_generate_ssa_resolve_data(void *ast_data, As
resolve_data->ssa_reg = funcdecl_generate_ssa(ast_data, context);
break;
case AST_FUNCTION_CALL:
- resolve_data->ssa_reg = funccall_generate_ssa(ast_data, resolve_data, context);
+ resolve_data->ssa_reg = funccall_generate_ssa(ast_data, context);
break;
case AST_STRUCT_DECL:
resolve_data->ssa_reg = structdecl_generate_ssa(ast_data, context);