Skip to content

Commit

Permalink
Zcu: preserve ordering of usingnamespace decls
Browse files Browse the repository at this point in the history
See comment. This slightly regresses a previous fix from this branch. A
proper solution will come soon, with the splitting up of `Decl` into
`Cau` and `Nav`.
  • Loading branch information
mlugg committed Mar 14, 2024
1 parent 347196f commit 7c32370
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Module.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4358,7 +4358,10 @@ fn scanDecl(iter: *ScanDeclIter, decl_inst: Zir.Inst.Index) Allocator.Error!void
};
},
.@"usingnamespace" => info: {
if (iter.pass != .unnamed) return;
// TODO: this isn't right! These should be considered unnamed. Name conflicts can happen here.
// The problem is, we need to preserve the decl ordering for `@typeInfo`.
// I'm not bothering to fix this now, since some upcoming changes will change this code significantly anyway.
if (iter.pass != .named) return;
const i = iter.usingnamespace_index;
iter.usingnamespace_index += 1;
break :info .{
Expand Down

0 comments on commit 7c32370

Please sign in to comment.