Skip to content

Commit

Permalink
frontend: fix use of undefined progress node
Browse files Browse the repository at this point in the history
This was causing a crash when running `zig test`.
  • Loading branch information
andrewrk committed May 26, 2024
1 parent 8b32daa commit de82e8d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Module.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5340,15 +5340,13 @@ pub fn populateTestFunctions(
// We have to call `ensureDeclAnalyzed` here in case `builtin.test_functions`
// was not referenced by start code.
mod.sema_prog_node = main_progress_node.start("Semantic Analysis", 0);
mod.codegen_prog_node = main_progress_node.start("Code Generation", 0);
defer {
mod.sema_prog_node.end();
mod.sema_prog_node = undefined;
mod.codegen_prog_node.end();
mod.codegen_prog_node = undefined;
}
try mod.ensureDeclAnalyzed(decl_index);
}

const decl = mod.declPtr(decl_index);
const test_fn_ty = decl.typeOf(mod).slicePtrFieldType(mod).childType(mod);

Expand Down Expand Up @@ -5449,7 +5447,15 @@ pub fn populateTestFunctions(
decl.val = new_val;
decl.has_tv = true;
}
try mod.linkerUpdateDecl(decl_index);
{
mod.codegen_prog_node = main_progress_node.start("Code Generation", 0);
defer {
mod.codegen_prog_node.end();
mod.codegen_prog_node = undefined;
}

try mod.linkerUpdateDecl(decl_index);
}
}

pub fn linkerUpdateDecl(zcu: *Zcu, decl_index: Decl.Index) !void {
Expand Down

0 comments on commit de82e8d

Please sign in to comment.