aboutsummaryrefslogtreecommitdiff
path: root/src/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ast.c b/src/ast.c
index 912b9c7..8e102ee 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -560,6 +560,9 @@ static void lhsexpr_resolve_rhs(LhsExpr *self, AstCompilerContext *context, AstR
if(ast_is_decl(self->rhs_expr)) {
result->type = RESOLVED_TYPE_LHS_EXPR;
result->value.lhs_expr = self;
+ /* Structs resolved type becomes the lhs while functions resolved type becomes the function signature they own */
+ if (self->rhs_expr->type == AST_STRUCT_DECL)
+ self->rhs_expr->resolve_data.type = *result;
} else {
*result = self->rhs_expr->resolve_data.type;
}
@@ -753,6 +756,7 @@ static TypeSize variable_type_get_byte_size(VariableType *self) {
type_size.fixed_size = 0;
switch(self->type) {
case VARIABLE_TYPE_NONE:
+ assert(bool_false && "Variable type not resolved!");
break;
case VARIABLE_TYPE_VARIABLE:
type_size = resolved_type_get_byte_size(&self->value.variable->resolved_var.resolve_data->type);
@@ -943,6 +947,7 @@ TypeSize resolved_type_get_byte_size(AstResolvedType *self) {
type_size.fixed_size = 0;
switch(self->type) {
case RESOLVED_TYPE_NONE:
+ assert(bool_false && "Type not resolved!");
break;
case RESOLVED_TYPE_LHS_EXPR: {
/* Resolved type until rhs is StructDecl or FunctionSignature */