Permalink
Browse files

Fix pull#380 for D1

  • Loading branch information...
1 parent 7c3897a commit 23846aca52ebd21efab36ff32924c5a6cc17c4c0 @don-clugston-sociomantic don-clugston-sociomantic committed Sep 15, 2011
Showing with 4 additions and 18 deletions.
  1. +4 −12 src/expression.c
  2. +0 −6 src/template.c
View
@@ -4811,15 +4811,9 @@ Expression *IsExp::semantic(Scope *sc)
if (id && !(sc->flags & SCOPEstaticif))
error("can only declare type aliases within static if conditionals");
- unsigned errors_save = global.errors;
- global.errors = 0;
- global.gag++; // suppress printing of error messages
+ unsigned errors_save = global.startGagging();
targ = targ->semantic(loc, sc);
- global.gag--;
- unsigned gerrors = global.errors;
- global.errors = errors_save;
-
- if (gerrors) // if any errors happened
+ if (global.endGagging(errors_save)) // if any errors happened
{ // then condition is false
goto Lno;
}
@@ -6520,11 +6514,9 @@ Expression *CallExp::semantic(Scope *sc)
* If not, go with partial explicit specialization.
*/
ti->semanticTiargs(sc);
- unsigned errors = global.errors;
- global.gag++;
+ unsigned errors = global.startGagging();
ti->semantic(sc);
- global.gag--;
- if (errors != global.errors)
+ if (global.endGagging(errors))
{
/* Didn't work, go with partial explicit specialization
*/
View
@@ -4467,7 +4467,6 @@ void TemplateInstance::semantic3(Scope *sc)
sc = sc->push(argsym);
sc = sc->push(this);
sc->tinst = this;
-#if DMDV2
int oldgag = global.gag;
/* If this is a speculative instantiation, gag errors.
* Future optimisation: If the results are actually needed, errors
@@ -4476,19 +4475,14 @@ void TemplateInstance::semantic3(Scope *sc)
*/
if (speculative && !global.gag)
global.gag = 1;
-#endif
for (size_t i = 0; i < members->dim; i++)
{
Dsymbol *s = (*members)[i];
s->semantic3(sc);
-#if DMDV2
if (global.gag && errors)
break;
-#endif
}
-#if DMDV2
global.gag = oldgag;
-#endif
sc = sc->pop();
sc->pop();
}

0 comments on commit 23846ac

Please sign in to comment.