| ... | @@ -851,6 +851,8 @@ pub fn update(self: *Module) !void { | ... | @@ -851,6 +851,8 @@ pub fn update(self: *Module) !void { |
| 851 | | 851 | |
| 852 | self.generation += 1; | 852 | self.generation += 1; |
| 853 | | 853 | |
| | 854 | self.clearErrors(); |
| | 855 | |
| 854 | // TODO Use the cache hash file system to detect which source files changed. | 856 | // TODO Use the cache hash file system to detect which source files changed. |
| 855 | // Until then we simulate a full cache miss. Source files could have been loaded for any reason; | 857 | // Until then we simulate a full cache miss. Source files could have been loaded for any reason; |
| 856 | // to force a refresh we unload now. | 858 | // to force a refresh we unload now. |
| ... | @@ -914,6 +916,31 @@ pub fn totalErrorCount(self: *Module) usize { | ... | @@ -914,6 +916,31 @@ pub fn totalErrorCount(self: *Module) usize { |
| 914 | return if (total == 0) @boolToInt(self.link_error_flags.no_entry_point_found) else total; | 916 | return if (total == 0) @boolToInt(self.link_error_flags.no_entry_point_found) else total; |
| 915 | } | 917 | } |
| 916 | | 918 | |
| | 919 | pub fn clearErrors(self: *Module) void { |
| | 920 | const allocator = self.allocator; |
| | 921 | { |
| | 922 | var it = self.failed_decls.iterator(); |
| | 923 | while (it.next()) |kv| { |
| | 924 | kv.value.destroy(allocator); |
| | 925 | } |
| | 926 | self.failed_decls.clear(); |
| | 927 | } |
| | 928 | { |
| | 929 | var it = self.failed_files.iterator(); |
| | 930 | while (it.next()) |kv| { |
| | 931 | kv.value.destroy(allocator); |
| | 932 | } |
| | 933 | self.failed_files.clear(); |
| | 934 | } |
| | 935 | { |
| | 936 | var it = self.failed_exports.iterator(); |
| | 937 | while (it.next()) |kv| { |
| | 938 | kv.value.destroy(allocator); |
| | 939 | } |
| | 940 | self.failed_exports.clear(); |
| | 941 | } |
| | 942 | } |
| | 943 | |
| 917 | pub fn getAllErrorsAlloc(self: *Module) !AllErrors { | 944 | pub fn getAllErrorsAlloc(self: *Module) !AllErrors { |
| 918 | var arena = std.heap.ArenaAllocator.init(self.allocator); | 945 | var arena = std.heap.ArenaAllocator.init(self.allocator); |
| 919 | errdefer arena.deinit(); | 946 | errdefer arena.deinit(); |
| ... | @@ -2092,6 +2119,7 @@ fn analyzeExport(self: *Module, scope: *Scope, src: usize, symbol_name: []const | ... | @@ -2092,6 +2119,7 @@ fn analyzeExport(self: *Module, scope: *Scope, src: usize, symbol_name: []const |
| 2092 | .Fn => {}, | 2119 | .Fn => {}, |
| 2093 | else => return self.fail(scope, src, "unable to export type '{}'", .{typed_value.ty}), | 2120 | else => return self.fail(scope, src, "unable to export type '{}'", .{typed_value.ty}), |
| 2094 | } | 2121 | } |
| | 2122 | |
| 2095 | try self.decl_exports.ensureCapacity(self.decl_exports.size + 1); | 2123 | try self.decl_exports.ensureCapacity(self.decl_exports.size + 1); |
| 2096 | try self.export_owners.ensureCapacity(self.export_owners.size + 1); | 2124 | try self.export_owners.ensureCapacity(self.export_owners.size + 1); |
| 2097 | | 2125 | |