| ... | @@ -851,8 +851,6 @@ pub fn update(self: *Module) !void { | ... | @@ -851,8 +851,6 @@ pub fn update(self: *Module) !void { |
| 851 | | 851 | |
| 852 | self.generation += 1; | 852 | self.generation += 1; |
| 853 | | 853 | |
| 854 | self.clearErrors(); | | |
| 855 | | | |
| 856 | // TODO Use the cache hash file system to detect which source files changed. | 854 | // TODO Use the cache hash file system to detect which source files changed. |
| 857 | // Until then we simulate a full cache miss. Source files could have been loaded for any reason; | 855 | // Until then we simulate a full cache miss. Source files could have been loaded for any reason; |
| 858 | // to force a refresh we unload now. | 856 | // to force a refresh we unload now. |
| ... | @@ -916,31 +914,6 @@ pub fn totalErrorCount(self: *Module) usize { | ... | @@ -916,31 +914,6 @@ pub fn totalErrorCount(self: *Module) usize { |
| 916 | return if (total == 0) @boolToInt(self.link_error_flags.no_entry_point_found) else total; | 914 | return if (total == 0) @boolToInt(self.link_error_flags.no_entry_point_found) else total; |
| 917 | } | 915 | } |
| 918 | | 916 | |
| 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 | | | |
| 944 | pub fn getAllErrorsAlloc(self: *Module) !AllErrors { | 917 | pub fn getAllErrorsAlloc(self: *Module) !AllErrors { |
| 945 | var arena = std.heap.ArenaAllocator.init(self.allocator); | 918 | var arena = std.heap.ArenaAllocator.init(self.allocator); |
| 946 | errdefer arena.deinit(); | 919 | errdefer arena.deinit(); |
| ... | @@ -1899,6 +1872,9 @@ fn deleteDeclExports(self: *Module, decl: *Decl) void { | ... | @@ -1899,6 +1872,9 @@ fn deleteDeclExports(self: *Module, decl: *Decl) void { |
| 1899 | } | 1872 | } |
| 1900 | | 1873 | |
| 1901 | self.bin_file.deleteExport(exp.link); | 1874 | self.bin_file.deleteExport(exp.link); |
| | 1875 | if (self.failed_exports.remove(exp)) |entry| { |
| | 1876 | entry.value.destroy(self.allocator); |
| | 1877 | } |
| 1902 | self.allocator.destroy(exp); | 1878 | self.allocator.destroy(exp); |
| 1903 | } | 1879 | } |
| 1904 | self.allocator.free(kv.value); | 1880 | self.allocator.free(kv.value); |
| ... | @@ -2191,6 +2167,7 @@ fn analyzeExport(self: *Module, scope: *Scope, src: usize, symbol_name: []const | ... | @@ -2191,6 +2167,7 @@ fn analyzeExport(self: *Module, scope: *Scope, src: usize, symbol_name: []const |
| 2191 | "exported symbol collision: {}", | 2167 | "exported symbol collision: {}", |
| 2192 | .{symbol_name}, | 2168 | .{symbol_name}, |
| 2193 | )); | 2169 | )); |
| | 2170 | new_export.status = .failed; |
| 2194 | } else { | 2171 | } else { |
| 2195 | self.bin_file.updateDeclExports(self, exported_decl, de_gop.kv.value) catch |err| switch (err) { | 2172 | self.bin_file.updateDeclExports(self, exported_decl, de_gop.kv.value) catch |err| switch (err) { |
| 2196 | error.OutOfMemory => return error.OutOfMemory, | 2173 | error.OutOfMemory => return error.OutOfMemory, |