mirror of
https://github.com/ziglang/zig.git
synced 2026-02-02 20:53:44 +00:00
parent
332a43858a
commit
b048fa4f13
30
src/Sema.zig
30
src/Sema.zig
@ -30337,6 +30337,18 @@ fn resolveTypeFieldsStruct(
|
||||
ty: Type,
|
||||
struct_obj: *Module.Struct,
|
||||
) CompileError!void {
|
||||
switch (sema.mod.declPtr(struct_obj.owner_decl).analysis) {
|
||||
.file_failure,
|
||||
.dependency_failure,
|
||||
.sema_failure,
|
||||
.sema_failure_retryable,
|
||||
=> {
|
||||
sema.owner_decl.analysis = .dependency_failure;
|
||||
sema.owner_decl.generation = sema.mod.generation;
|
||||
return error.AnalysisFail;
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
switch (struct_obj.status) {
|
||||
.none => {},
|
||||
.field_types_wip => {
|
||||
@ -30357,10 +30369,23 @@ fn resolveTypeFieldsStruct(
|
||||
}
|
||||
|
||||
struct_obj.status = .field_types_wip;
|
||||
errdefer struct_obj.status = .none;
|
||||
try semaStructFields(sema.mod, struct_obj);
|
||||
}
|
||||
|
||||
fn resolveTypeFieldsUnion(sema: *Sema, ty: Type, union_obj: *Module.Union) CompileError!void {
|
||||
switch (sema.mod.declPtr(union_obj.owner_decl).analysis) {
|
||||
.file_failure,
|
||||
.dependency_failure,
|
||||
.sema_failure,
|
||||
.sema_failure_retryable,
|
||||
=> {
|
||||
sema.owner_decl.analysis = .dependency_failure;
|
||||
sema.owner_decl.generation = sema.mod.generation;
|
||||
return error.AnalysisFail;
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
switch (union_obj.status) {
|
||||
.none => {},
|
||||
.field_types_wip => {
|
||||
@ -30381,6 +30406,7 @@ fn resolveTypeFieldsUnion(sema: *Sema, ty: Type, union_obj: *Module.Union) Compi
|
||||
}
|
||||
|
||||
union_obj.status = .field_types_wip;
|
||||
errdefer union_obj.status = .none;
|
||||
try semaUnionFields(sema.mod, union_obj);
|
||||
union_obj.status = .have_field_types;
|
||||
}
|
||||
@ -30445,9 +30471,7 @@ fn resolveInferredErrorSetTy(
|
||||
fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void {
|
||||
const gpa = mod.gpa;
|
||||
const decl_index = struct_obj.owner_decl;
|
||||
const file_scope = struct_obj.namespace.file_scope;
|
||||
if (file_scope.status != .success_zir) return error.AnalysisFail;
|
||||
const zir = file_scope.zir;
|
||||
const zir = struct_obj.namespace.file_scope.zir;
|
||||
const extended = zir.instructions.items(.data)[struct_obj.zir_index].extended;
|
||||
assert(extended.opcode == .struct_decl);
|
||||
const small = @bitCast(Zir.Inst.StructDecl.Small, extended.small);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user