aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-03-13 19:16:09 +0000
committermlugg <mlugg@mlugg.co.uk>2024-03-14 07:40:08 +0000
commit7c3237019454a6009d96eca31f36a1d9e6ce02aa (patch)
tree2b67d56ff2e9ec9c44153c48f201ac506d674b20 /src/Module.zig
parent347196f905c083047fdc0a3b72656f1867973a13 (diff)
downloadzig-7c3237019454a6009d96eca31f36a1d9e6ce02aa.tar.gz
zig-7c3237019454a6009d96eca31f36a1d9e6ce02aa.zip
Zcu: preserve ordering of `usingnamespace` decls
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`.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 95b96b3605..8f6def21ae 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -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 .{