Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
simplify self-import filtering
Browse files Browse the repository at this point in the history
- directly compare pointers instead of module indices
- rename e (edge) -> imp (import)
  • Loading branch information
MartinNowak committed Oct 7, 2016
1 parent 6e27f17 commit d364c4b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/rt/minfo.d
Expand Up @@ -250,13 +250,14 @@ struct ModuleGroup
// preallocate enough space to store all the indexes
int *edge = cast(int*)malloc(int.sizeof * _modules.length);
size_t nEdges = 0;
foreach (e; m.importedModules)
foreach (imp; m.importedModules)
{
if(auto impidx = e in modIndexes)
if (imp is m) // self-import
continue;
if (auto impidx = imp in modIndexes)
{
if (*impidx != i)
if (!bts(reachable, *impidx))
edge[nEdges++] = *impidx;
if (!bts(reachable, *impidx))
edge[nEdges++] = *impidx;
}
}
// trim space to what is needed.
Expand Down

0 comments on commit d364c4b

Please sign in to comment.