aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-05-05 17:00:10 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-05-05 17:00:10 -0700
commit17067e0e6b6d28623b47b639853abc69a83b620a (patch)
tree6699eaf7624cf486158d4b0481b617c3b3320ae9 /src/Module.zig
parent9b1aac8a654d1ee3515e2de8d477cf1909e63fdf (diff)
downloadzig-17067e0e6b6d28623b47b639853abc69a83b620a.tar.gz
zig-17067e0e6b6d28623b47b639853abc69a83b620a.zip
stage2: fix contents hash computation
during an incremental update change detection, the function call to get the old contents hash took place after mangling the old ZIR index, making it access the wrong array index.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Module.zig b/src/Module.zig
index d78b9c95e6..e1b4e0b4e2 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -2436,6 +2436,7 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange
// Anonymous decls and the root decl have this set to 0. We still need
// to walk them but we do not need to modify this value.
if (decl.zir_decl_index != 0) {
+ const old_hash = decl.contentsHashZir(old_zir);
decl.zir_decl_index = extra_map.get(decl.zir_decl_index) orelse {
try deleted_decls.append(gpa, decl);
continue;
@@ -2446,7 +2447,6 @@ fn updateZirRefs(gpa: *Allocator, file: *Scope.File, old_zir: Zir) !UpdateChange
};
decl.name = new_zir.nullTerminatedString(new_name_index).ptr;
- const old_hash = decl.contentsHashZir(old_zir);
const new_hash = decl.contentsHashZir(new_zir);
if (!std.zig.srcHashEql(old_hash, new_hash)) {
try outdated_decls.append(gpa, decl);