authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-08-24 15:26:49+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-08-24 15:26:49+03:00
logd515d37934476365929401a0ba7e5639b09a648a
tree1e9e2c3d0235b9188145b95b58aab102350400c3
parent38215ccc3e7bd4c79e70731c6d50556356c76c39

AstGen: make root decls relative to beginning of file

Closes #12610

1 files changed, 4 insertions(+), 2 deletions(-)

src/AstGen.zig+4-2
......@@ -4265,10 +4265,13 @@ fn structDeclInner(
42654265 // are in scope, so that field types, alignments, and default value expressions
42664266 // can refer to decls within the struct itself.
42674267 astgen.advanceSourceCursorToNode(node);
4268 // If `node == 0` then this is the root struct and all the declarations should
4269 // be relative to the beginning of the file.
4270 const decl_line = if (node == 0) 0 else astgen.source_line;
42684271 var block_scope: GenZir = .{
42694272 .parent = &namespace.base,
42704273 .decl_node_index = node,
4271 .decl_line = astgen.source_line,
4274 .decl_line = decl_line,
42724275 .astgen = astgen,
42734276 .force_comptime = true,
42744277 .in_defer = false,
......@@ -11764,7 +11767,6 @@ fn scanDecls(astgen: *AstGen, namespace: *Scope.Namespace, members: []const Ast.
1176411767 }
1176511768 }
1176611769
11767 // const index_name = try astgen.identAsString(index_token);
1176811770 var s = namespace.parent;
1176911771 while (true) switch (s.tag) {
1177011772 .local_val => {