diff --git a/src/AstGen.zig b/src/AstGen.zig index 8e6721d7bc..422827c673 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -4233,13 +4233,10 @@ fn structDeclInner( // are in scope, so that field types, alignments, and default value expressions // can refer to decls within the struct itself. astgen.advanceSourceCursorToNode(node); - // If `node == 0` then this is the root struct and all the declarations should - // be relative to the beginning of the file. - const decl_line = if (node == 0) 0 else astgen.source_line; var block_scope: GenZir = .{ .parent = &namespace.base, .decl_node_index = node, - .decl_line = decl_line, + .decl_line = gz.decl_line, .astgen = astgen, .force_comptime = true, .instructions = gz.instructions, @@ -4439,7 +4436,7 @@ fn unionDeclInner( var block_scope: GenZir = .{ .parent = &namespace.base, .decl_node_index = node, - .decl_line = astgen.source_line, + .decl_line = gz.decl_line, .astgen = astgen, .force_comptime = true, .instructions = gz.instructions, @@ -4722,7 +4719,7 @@ fn containerDecl( var block_scope: GenZir = .{ .parent = &namespace.base, .decl_node_index = node, - .decl_line = astgen.source_line, + .decl_line = gz.decl_line, .astgen = astgen, .force_comptime = true, .instructions = gz.instructions, @@ -4827,7 +4824,7 @@ fn containerDecl( var block_scope: GenZir = .{ .parent = &namespace.base, .decl_node_index = node, - .decl_line = astgen.source_line, + .decl_line = gz.decl_line, .astgen = astgen, .force_comptime = true, .instructions = gz.instructions,