| ... | @@ -697,16 +697,9 @@ pub const Module = struct { | ... | @@ -697,16 +697,9 @@ pub const Module = struct { |
| 697 | }; | 697 | }; |
| 698 | } | 698 | } |
| 699 | | 699 | |
| 700 | fn analyzeRoot(self: *Module, root_scope: *Scope.ZIRModule) !void { | 700 | fn getTextModule(self: *Module, root_scope: *Scope.ZIRModule) !*text.Module { |
| 701 | // TODO use the cache to identify, from the modified source files, the decls which have | 701 | switch (root_scope.status) { |
| 702 | // changed based on the span of memory that represents the decl in the re-parsed source file. | 702 | .unloaded => { |
| 703 | // Use the cached dependency graph to recursively determine the set of decls which need | | |
| 704 | // regeneration. | | |
| 705 | // Here we simulate adding a source file which was previously not part of the compilation, | | |
| 706 | // which means scanning the decls looking for exports. | | |
| 707 | // TODO also identify decls that need to be deleted. | | |
| 708 | const src_module = switch (root_scope.status) { | | |
| 709 | .unloaded => blk: { | | |
| 710 | try self.failed_files.ensureCapacity(self.failed_files.size + 1); | 703 | try self.failed_files.ensureCapacity(self.failed_files.size + 1); |
| 711 | | 704 | |
| 712 | var keep_source = false; | 705 | var keep_source = false; |
| ... | @@ -743,12 +736,23 @@ pub const Module = struct { | ... | @@ -743,12 +736,23 @@ pub const Module = struct { |
| 743 | root_scope.contents = .{ .module = zir_module }; | 736 | root_scope.contents = .{ .module = zir_module }; |
| 744 | keep_zir_module = true; | 737 | keep_zir_module = true; |
| 745 | | 738 | |
| 746 | break :blk zir_module; | 739 | return zir_module; |
| 747 | }, | 740 | }, |
| 748 | | 741 | |
| 749 | .unloaded_parse_failure, .loaded_parse_failure => return error.AnalysisFail, | 742 | .unloaded_parse_failure, .loaded_parse_failure => return error.AnalysisFail, |
| 750 | .loaded_success => root_scope.contents.module, | 743 | .loaded_success => return root_scope.contents.module, |
| 751 | }; | 744 | } |
| | 745 | } |
| | 746 | |
| | 747 | fn analyzeRoot(self: *Module, root_scope: *Scope.ZIRModule) !void { |
| | 748 | // TODO use the cache to identify, from the modified source files, the decls which have |
| | 749 | // changed based on the span of memory that represents the decl in the re-parsed source file. |
| | 750 | // Use the cached dependency graph to recursively determine the set of decls which need |
| | 751 | // regeneration. |
| | 752 | // Here we simulate adding a source file which was previously not part of the compilation, |
| | 753 | // which means scanning the decls looking for exports. |
| | 754 | // TODO also identify decls that need to be deleted. |
| | 755 | const src_module = try self.getTextModule(root_scope); |
| 752 | | 756 | |
| 753 | // Here we ensure enough queue capacity to store all the decls, so that later we can use | 757 | // Here we ensure enough queue capacity to store all the decls, so that later we can use |
| 754 | // appendAssumeCapacity. | 758 | // appendAssumeCapacity. |