Fixing field access / Enum bugs
This commit is contained in:
@@ -6,6 +6,8 @@ Test :: struct
|
||||
test: Test
|
||||
member := test.len
|
||||
|
||||
thing: Memory.Allocator_Kind = Memory.Allocator_Kind.Heap
|
||||
|
||||
a_type :: S64
|
||||
pointer_type :: *S64
|
||||
// null_pointer: pointer_type = null
|
||||
|
||||
@@ -663,19 +663,20 @@ resolve_field_access(Ast_Expr *node, Ast_Scope *context){
|
||||
field_access_scope = context;
|
||||
Operand op = resolve_expr(node, AST_CANT_BE_NULL);
|
||||
|
||||
if(op.type == type_type && is_enum(op.type_val)) op.type = op.type_val;
|
||||
if(current) current->type = op.type;
|
||||
if(is_pointer(op.type)) op.type = op.type->base;
|
||||
type_complete(op.type);
|
||||
Ast_Resolved_Type *type = op.type;
|
||||
if(op.type == type_type && is_enum(op.type_val)) type = op.type_val;
|
||||
if(current) current->type = type;
|
||||
if(is_pointer(type)) type = type->base;
|
||||
type_complete(type);
|
||||
|
||||
if(next && !is_struct(op.type) && !is_enum(op.type)){
|
||||
if(next && !is_struct(type) && !is_enum(type)){
|
||||
compiler_error(node->pos, "Dot access");
|
||||
}
|
||||
|
||||
if(!next)
|
||||
return op;
|
||||
|
||||
new_context = ((Ast_Decl *)op.type->ast)->scope;
|
||||
new_context = ((Ast_Decl *)type->ast)->scope;
|
||||
}
|
||||
|
||||
assert(next);
|
||||
|
||||
Reference in New Issue
Block a user