diff options
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index 1f253ac157..fefa5352da 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -2142,7 +2142,6 @@ static Error resolve_struct_type(CodeGen *g, ZigType *struct_type) { } assert(struct_type->data.structure.fields || struct_type->data.structure.src_field_count == 0); - assert(decl_node->type == NodeTypeContainerDecl || decl_node->type == NodeTypeContainerInitExpr); size_t field_count = struct_type->data.structure.src_field_count; @@ -2749,10 +2748,9 @@ static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) { src_assert(struct_type->data.structure.fields == nullptr, decl_node); struct_type->data.structure.fields = alloc_type_struct_fields(field_count); - } else if (decl_node->type == NodeTypeContainerInitExpr) { + } else if (is_anon_container(struct_type)) { field_count = struct_type->data.structure.src_field_count; - src_assert(is_anon_container(struct_type), decl_node); src_assert(field_count == 0 || struct_type->data.structure.fields != nullptr, decl_node); } else zig_unreachable(); @@ -2785,7 +2783,7 @@ static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) { struct_type->data.structure.resolve_status = ResolveStatusInvalid; return ErrorSemanticAnalyzeFail; } - } else if (decl_node->type == NodeTypeContainerInitExpr) { + } else if (is_anon_container(struct_type)) { field_node = type_struct_field->decl_node; src_assert(type_struct_field->type_entry != nullptr, field_node); @@ -2812,7 +2810,7 @@ static Error resolve_struct_zero_bits(CodeGen *g, ZigType *struct_type) { type_struct_field->type_val = field_type_val; if (struct_type->data.structure.resolve_status == ResolveStatusInvalid) return ErrorSemanticAnalyzeFail; - } else if (decl_node->type == NodeTypeContainerInitExpr) { + } else if (is_anon_container(struct_type)) { field_type_val = type_struct_field->type_val; } else zig_unreachable(); @@ -2901,7 +2899,6 @@ static Error resolve_struct_alignment(CodeGen *g, ZigType *struct_type) { } struct_type->data.structure.resolve_loop_flag_other = true; - assert(decl_node->type == NodeTypeContainerDecl || decl_node->type == NodeTypeContainerInitExpr); size_t field_count = struct_type->data.structure.src_field_count; bool packed = struct_type->data.structure.layout == ContainerLayoutPacked; |
