mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Zcu: remove old decls after scanning namespace
This commit is contained in:
parent
48af67c152
commit
7c4793f23c
@ -4103,6 +4103,21 @@ pub fn scanNamespace(
|
||||
for (decls) |decl_inst| {
|
||||
try scanDecl(&scan_decl_iter, decl_inst);
|
||||
}
|
||||
|
||||
if (seen_decls.count() != namespace.decls.count()) {
|
||||
// Do a pass over the namespace contents and remove any decls from the last update
|
||||
// which were removed in this one.
|
||||
var i: usize = 0;
|
||||
while (i < namespace.decls.count()) {
|
||||
const decl_index = namespace.decls.keys()[i];
|
||||
const decl = zcu.declPtr(decl_index);
|
||||
if (!seen_decls.contains(decl.name)) {
|
||||
// We must preserve namespace ordering for @typeInfo.
|
||||
namespace.decls.orderedRemoveAt(i);
|
||||
i -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const ScanDeclIter = struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user