authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-03-08 10:59:32+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2024-03-14 07:40:06+00:00
log7c4793f23c971f5305c63f1b343e7f8576f32781
tree0528a866ba73798768bae9f6cc91d23826302300
parent48af67c15230f81ff70d6f27364452116b5bdf30
signaturelock-open Commit is signed but in an unrecognized format.

Zcu: remove old decls after scanning namespace


1 files changed, 15 insertions(+), 0 deletions(-)

src/Module.zig+15
...@@ -4103,6 +4103,21 @@ pub fn scanNamespace(...@@ -4103,6 +4103,21 @@ pub fn scanNamespace(
4103 for (decls) |decl_inst| {4103 for (decls) |decl_inst| {
4104 try scanDecl(&scan_decl_iter, decl_inst);4104 try scanDecl(&scan_decl_iter, decl_inst);
4105 }4105 }
4106
4107 if (seen_decls.count() != namespace.decls.count()) {
4108 // Do a pass over the namespace contents and remove any decls from the last update
4109 // which were removed in this one.
4110 var i: usize = 0;
4111 while (i < namespace.decls.count()) {
4112 const decl_index = namespace.decls.keys()[i];
4113 const decl = zcu.declPtr(decl_index);
4114 if (!seen_decls.contains(decl.name)) {
4115 // We must preserve namespace ordering for @typeInfo.
4116 namespace.decls.orderedRemoveAt(i);
4117 i -= 1;
4118 }
4119 }
4120 }
4106}4121}
41074122
4108const ScanDeclIter = struct {4123const ScanDeclIter = struct {