aboutsummaryrefslogtreecommitdiff
path: root/src/ssa
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-08-01 20:36:51 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit4ca3b74621c3608de42a91730a71892d9d7c27b5 (patch)
treeae6ed7a1c37fc7fe32b3f763b839e65fe6becbeb /src/ssa
parent0f26e1d204d3a3026ca3edfc4c6bd9638b2632e7 (diff)
Remove nullable... it's bad to have magic. Static analysis can do it instead
Diffstat (limited to 'src/ssa')
-rw-r--r--src/ssa/ssa.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ssa/ssa.c b/src/ssa/ssa.c
index 405d8e4..707ccd0 100644
--- a/src/ssa/ssa.c
+++ b/src/ssa/ssa.c
@@ -342,8 +342,8 @@ static CHECK_RESULT SsaRegister lhsexpr_generate_ssa(Ast *self, SsaCompilerConte
if(lhs_expr->is_extern)
return lhsexpr_extern_generate_ssa(lhs_expr, context);
- if(is_not_null(lhs_expr->rhs_expr)) {
- Ast *rhs_expr = nullable_unwrap(lhs_expr->rhs_expr);
+ if(lhs_expr->rhs_expr) {
+ Ast *rhs_expr = lhs_expr->rhs_expr;
SsaRegister rhs_reg;
rhs_reg = ast_generate_ssa(rhs_expr, context);
/*
@@ -433,7 +433,7 @@ static CHECK_RESULT SsaRegister funccall_generate_ssa(Ast *self, SsaCompilerCont
throw_if_error(ssa_ins_push(context->ssa, arg_reg));
}
- assert((is_not_null(self->resolve_data.type->rhs_expr) && nullable_unwrap(self->resolve_data.type->rhs_expr)->type == AST_FUNCTION_DECL) ||
+ assert((self->resolve_data.type->rhs_expr && self->resolve_data.type->rhs_expr->type == AST_FUNCTION_DECL) ||
self->resolve_data.type->type.type == VARIABLE_TYPE_SIGNATURE);
if(self->resolve_data.type->is_extern) {
amal_log_error("TODO: Implement extern function call (extern function %.*s was called)", func_call->func.name.size, func_call->func.name.data);
@@ -442,7 +442,7 @@ static CHECK_RESULT SsaRegister funccall_generate_ssa(Ast *self, SsaCompilerCont
} else {
FunctionDecl *func_to_call;
/* rhs wont be null here because only extern variable can't have rhs */
- func_to_call = nullable_unwrap(self->resolve_data.type->rhs_expr)->value.func_decl;
+ func_to_call = self->resolve_data.type->rhs_expr->value.func_decl;
amal_log_debug("SSA funccall %.*s, func index ptr: %p", func_call->func.name.size, func_call->func.name.data, func_to_call);
throw_if_error(ssa_ins_call(context->ssa, func_to_call, &reg));
}