Skip to content

Commit

Permalink
Deprecation: Shadowing local variables (deprecated -> error)
Browse files Browse the repository at this point in the history
This has been deprecated since version 0.061, it is time it went away.
  • Loading branch information
yebblies committed Oct 28, 2012
1 parent 93c489e commit a4c4e44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/expression.c
Expand Up @@ -5521,7 +5521,7 @@ Expression *DeclarationExp::semantic(Scope *sc)
s->toPrettyChars(), sc->func->toChars());
return new ErrorExp();
}
else if (!global.params.useDeprecated)
else
{ // Disallow shadowing

for (Scope *scx = sc->enclosing; scx && scx->func == sc->func; scx = scx->enclosing)
Expand All @@ -5531,7 +5531,7 @@ Expression *DeclarationExp::semantic(Scope *sc)
(s2 = scx->scopesym->symtab->lookup(s->ident)) != NULL &&
s != s2)
{
deprecation("shadowing declaration %s is deprecated", s->toPrettyChars());
error("is shadowing declaration %s", s->toPrettyChars());
return new ErrorExp();
}
}
Expand Down

0 comments on commit a4c4e44

Please sign in to comment.