Skip to content

Commit

Permalink
[Refactoring] Fix ungagSpeculative() position
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Apr 29, 2014
1 parent 669e2e4 commit 77de1b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
27 changes: 6 additions & 21 deletions src/class.c
Expand Up @@ -308,6 +308,9 @@ void ClassDeclaration::semantic(Scope *sc)
((TypeClass *)type)->sym = this;
}

// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

if (semanticRun == PASSinit)
{
protection = sc->protection;
Expand Down Expand Up @@ -337,9 +340,6 @@ void ClassDeclaration::semantic(Scope *sc)
// Expand any tuples in baseclasses[]
for (size_t i = 0; i < baseclasses->dim; )
{
// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

BaseClass *b = (*baseclasses)[i];
b->type = b->type->semantic(loc, sc);

Expand All @@ -364,9 +364,6 @@ void ClassDeclaration::semantic(Scope *sc)
// See if there's a base class as first in baseclasses[]
if (baseclasses->dim)
{
// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

BaseClass *b = (*baseclasses)[0];
//b->type = b->type->semantic(loc, sc);

Expand Down Expand Up @@ -443,9 +440,6 @@ void ClassDeclaration::semantic(Scope *sc)
// Check for errors, handle forward references
for (size_t i = (baseClass ? 1 : 0); i < baseclasses->dim; )
{
// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

BaseClass *b = (*baseclasses)[i];
b->type = b->type->semantic(loc, sc);

Expand Down Expand Up @@ -661,9 +655,6 @@ void ClassDeclaration::semantic(Scope *sc)
for (size_t i = 0; i < members_dim; i++)
{
Dsymbol *s = (*members)[i];

// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();
s->semantic(sc2);
}

Expand Down Expand Up @@ -1308,6 +1299,9 @@ void InterfaceDeclaration::semantic(Scope *sc)
((TypeClass *)type)->sym = this;
}

// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

if (semanticRun == PASSinit)
{
protection = sc->protection;
Expand All @@ -1328,9 +1322,6 @@ void InterfaceDeclaration::semantic(Scope *sc)
// Expand any tuples in baseclasses[]
for (size_t i = 0; i < baseclasses->dim; )
{
// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

BaseClass *b = (*baseclasses)[i];
b->type = b->type->semantic(loc, sc);

Expand Down Expand Up @@ -1358,9 +1349,6 @@ void InterfaceDeclaration::semantic(Scope *sc)
// Check for errors, handle forward references
for (size_t i = 0; i < baseclasses->dim; )
{
// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

BaseClass *b = (*baseclasses)[i];
b->type = b->type->semantic(loc, sc);

Expand Down Expand Up @@ -1500,9 +1488,6 @@ void InterfaceDeclaration::semantic(Scope *sc)
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];

// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();
s->semantic(sc2);
}

Expand Down
6 changes: 3 additions & 3 deletions src/struct.c
Expand Up @@ -695,6 +695,9 @@ void StructDeclaration::semantic(Scope *sc)
((TypeStruct *)type)->sym = this;
}

// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();

if (semanticRun == PASSinit)
{
protection = sc->protection;
Expand Down Expand Up @@ -767,9 +770,6 @@ void StructDeclaration::semantic(Scope *sc)
if (sizeok == SIZEOKnone && s->isAliasDeclaration())
finalizeSize(sc2);
}

// Ungag errors when not speculative
Ungag ungag = ungagSpeculative();
s->semantic(sc2);
}
finalizeSize(sc2);
Expand Down

0 comments on commit 77de1b5

Please sign in to comment.