mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Stage2: fix incremental compilation after error
This commit is contained in:
parent
53fead580e
commit
e5a3cb8d71
@ -851,6 +851,8 @@ pub fn update(self: *Module) !void {
|
||||
|
||||
self.generation += 1;
|
||||
|
||||
self.clearErrors();
|
||||
|
||||
// TODO Use the cache hash file system to detect which source files changed.
|
||||
// Until then we simulate a full cache miss. Source files could have been loaded for any reason;
|
||||
// to force a refresh we unload now.
|
||||
@ -914,6 +916,31 @@ pub fn totalErrorCount(self: *Module) usize {
|
||||
return if (total == 0) @boolToInt(self.link_error_flags.no_entry_point_found) else total;
|
||||
}
|
||||
|
||||
pub fn clearErrors(self: *Module) void {
|
||||
const allocator = self.allocator;
|
||||
{
|
||||
var it = self.failed_decls.iterator();
|
||||
while (it.next()) |kv| {
|
||||
kv.value.destroy(allocator);
|
||||
}
|
||||
self.failed_decls.clear();
|
||||
}
|
||||
{
|
||||
var it = self.failed_files.iterator();
|
||||
while (it.next()) |kv| {
|
||||
kv.value.destroy(allocator);
|
||||
}
|
||||
self.failed_files.clear();
|
||||
}
|
||||
{
|
||||
var it = self.failed_exports.iterator();
|
||||
while (it.next()) |kv| {
|
||||
kv.value.destroy(allocator);
|
||||
}
|
||||
self.failed_exports.clear();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn getAllErrorsAlloc(self: *Module) !AllErrors {
|
||||
var arena = std.heap.ArenaAllocator.init(self.allocator);
|
||||
errdefer arena.deinit();
|
||||
@ -2092,6 +2119,7 @@ fn analyzeExport(self: *Module, scope: *Scope, src: usize, symbol_name: []const
|
||||
.Fn => {},
|
||||
else => return self.fail(scope, src, "unable to export type '{}'", .{typed_value.ty}),
|
||||
}
|
||||
|
||||
try self.decl_exports.ensureCapacity(self.decl_exports.size + 1);
|
||||
try self.export_owners.ensureCapacity(self.export_owners.size + 1);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user