| ... | @@ -545,10 +545,19 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { | ... | @@ -545,10 +545,19 @@ pub fn updateZirRefs(pt: Zcu.PerThread) Allocator.Error!void { |
| 545 | pub fn ensureFileAnalyzed(pt: Zcu.PerThread, file_index: Zcu.File.Index) Zcu.SemaError!void { | 545 | pub fn ensureFileAnalyzed(pt: Zcu.PerThread, file_index: Zcu.File.Index) Zcu.SemaError!void { |
| 546 | const file_root_type = pt.zcu.fileRootType(file_index); | 546 | const file_root_type = pt.zcu.fileRootType(file_index); |
| 547 | if (file_root_type != .none) { | 547 | if (file_root_type != .none) { |
| 548 | _ = try pt.ensureTypeUpToDate(file_root_type); | 548 | if (pt.ensureTypeUpToDate(file_root_type)) |_| { |
| 549 | } else { | 549 | return; |
| 550 | return pt.semaFile(file_index); | 550 | } else |err| switch (err) { |
| | 551 | error.AnalysisFail => { |
| | 552 | // The file's root `struct_decl` has, at some point, been lost, because the file failed AstGen. |
| | 553 | // Clear `file_root_type`, and try the `semaFile` call below, in case the instruction has since |
| | 554 | // been discovered under a new `TrackedInst.Index`. |
| | 555 | pt.zcu.setFileRootType(file_index, .none); |
| | 556 | }, |
| | 557 | else => |e| return e, |
| | 558 | } |
| 551 | } | 559 | } |
| | 560 | return pt.semaFile(file_index); |
| 552 | } | 561 | } |
| 553 | | 562 | |
| 554 | /// Ensures that the state of the given `ComptimeUnit` is fully up-to-date, performing re-analysis | 563 | /// Ensures that the state of the given `ComptimeUnit` is fully up-to-date, performing re-analysis |