Skip to content

Commit

Permalink
Merge pull request #5156 from WalterBright/nspaceForeach
Browse files Browse the repository at this point in the history
nspace.d: use foreach
  • Loading branch information
yebblies committed Oct 4, 2015
2 parents 3876c18 + 8e6dce3 commit 43c73c1
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/nspace.d
Expand Up @@ -74,25 +74,21 @@ public:
sc = sc.push(this);
sc.linkage = LINKcpp; // note that namespaces imply C++ linkage
sc.parent = this;
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
//printf("add %s to scope %s\n", s->toChars(), toChars());
s.addMember(sc, this);
}
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
s.setScope(sc);
}
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
s.importAll(sc);
}
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
static if (LOG)
{
printf("\tmember '%s', kind = '%s'\n", s.toChars(), s.kind());
Expand Down Expand Up @@ -121,9 +117,8 @@ public:
assert(sc);
sc = sc.push(this);
sc.linkage = LINKcpp;
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
static if (LOG)
{
printf("\tmember '%s', kind = '%s'\n", s.toChars(), s.kind());
Expand Down Expand Up @@ -151,9 +146,8 @@ public:
{
sc = sc.push(this);
sc.linkage = LINKcpp;
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
s.semantic3(sc);
}
sc.pop();
Expand All @@ -169,9 +163,8 @@ public:
{
if (members)
{
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
if (s)
{
if (s.apply(fp, param))
Expand All @@ -187,9 +180,8 @@ public:
//printf("Nspace::hasPointers() %s\n", toChars());
if (members)
{
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
//printf(" s = %s %s\n", s->kind(), s->toChars());
if (s.hasPointers())
{
Expand All @@ -207,9 +199,8 @@ public:
semantic(null); // try to resolve it
if (members)
{
for (size_t i = 0; i < members.dim; i++)
foreach (s; *members)
{
Dsymbol s = (*members)[i];
//printf("\t%s\n", s->toChars());
s.setFieldOffset(ad, poffset, isunion);
}
Expand Down

0 comments on commit 43c73c1

Please sign in to comment.