authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-13 18:23:53-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:15-07:00
log1dbb616e73404b789b5c85491eb905b193b9b4cb
treea00a468952f93f8a781aaf5f38ba297271fb1181
parente098b287e18b8a7a4df0fdb48d32fb4376daba07

Module: handle incremental update from ZIR with AST errors


1 files changed, 3 insertions(+), 1 deletions(-)

src/Module.zig+3-1
...@@ -3867,6 +3867,9 @@ fn updateZirRefs(mod: *Module, file: *File, old_zir: Zir) !void {...@@ -3867,6 +3867,9 @@ fn updateZirRefs(mod: *Module, file: *File, old_zir: Zir) !void {
3867 const gpa = mod.gpa;3867 const gpa = mod.gpa;
3868 const new_zir = file.zir;3868 const new_zir = file.zir;
38693869
3870 // The root decl will be null if the previous ZIR had AST errors.
3871 const root_decl = file.root_decl.unwrap() orelse return;
3872
3870 // Maps from old ZIR to new ZIR, struct_decl, enum_decl, etc. Any instruction which3873 // Maps from old ZIR to new ZIR, struct_decl, enum_decl, etc. Any instruction which
3871 // creates a namespace, gets mapped from old to new here.3874 // creates a namespace, gets mapped from old to new here.
3872 var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{};3875 var inst_map: std.AutoHashMapUnmanaged(Zir.Inst.Index, Zir.Inst.Index) = .{};
...@@ -3884,7 +3887,6 @@ fn updateZirRefs(mod: *Module, file: *File, old_zir: Zir) !void {...@@ -3884,7 +3887,6 @@ fn updateZirRefs(mod: *Module, file: *File, old_zir: Zir) !void {
3884 var decl_stack: ArrayListUnmanaged(Decl.Index) = .{};3887 var decl_stack: ArrayListUnmanaged(Decl.Index) = .{};
3885 defer decl_stack.deinit(gpa);3888 defer decl_stack.deinit(gpa);
38863889
3887 const root_decl = file.root_decl.unwrap().?;
3888 try decl_stack.append(gpa, root_decl);3890 try decl_stack.append(gpa, root_decl);
38893891
3890 file.deleted_decls.clearRetainingCapacity();3892 file.deleted_decls.clearRetainingCapacity();