diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-05-12 10:27:14 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-05-12 10:27:14 +0100 |
| commit | 45eecc0905fa72b17a74b2a258598eae1da10597 (patch) | |
| tree | a558b74855d8b13b8889448383b962315995cd22 /src/check_expr.c | |
| parent | 87f1a62ca4280105eb845e5bae3acd8b8a0a0810 (diff) | |
Reimplement #ordered again
Diffstat (limited to 'src/check_expr.c')
| -rw-r--r-- | src/check_expr.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/check_expr.c b/src/check_expr.c index f205935c2..a7e85f819 100644 --- a/src/check_expr.c +++ b/src/check_expr.c @@ -555,7 +555,13 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node) { struct_type->Record.field_count = field_count; struct_type->Record.names = make_names_field_for_record(c, c->context.scope); - if (false && !st->is_packed && !st->is_ordered) { + type_set_offsets(c->allocator, struct_type); + + + if (!struct_type->failure && !st->is_packed && !st->is_ordered) { + struct_type->failure = false; + struct_type->Record.are_offsets_set = false; + struct_type->Record.offsets = NULL; // NOTE(bill): Reorder fields for reduced size/performance Entity **reordered_fields = gb_alloc_array(c->allocator, Entity *, field_count); @@ -576,12 +582,9 @@ void check_struct_type(Checker *c, Type *struct_type, AstNode *node) { struct_type->Record.fields = reordered_fields; } - { - // i64 size = type_size_of(c->allocator, struct_type); - } - type_set_offsets(c->allocator, struct_type); + if (st->align != NULL) { if (st->is_packed) { syntax_error_node(st->align, "`#align` cannot be applied with `#packed`"); |