Actual use location information when looking for local variables.

This addresses the bulk of <rdar://problem/15344950>, which involes us
not being able to find local variable declarations in expressions when
the parser didn't pre-bind them for us.

The fix to name lookup itself insures that a case such as 
  case (var a, a)

doesn't allow the second 'a' to find the first.


Swift SVN r9858
This commit is contained in:
Doug Gregor
2013-10-31 22:56:02 +00:00
parent d873764add
commit 1082ea51a0
3 changed files with 15 additions and 3 deletions

View File

@@ -280,8 +280,10 @@ struct FindLocalVal : public StmtVisitor<FindLocalVal> {
if (!IntersectsRange(S->getSourceRange()))
return;
for (auto Label : S->getCaseLabels()) {
for (auto P : Label->getPatterns())
checkPattern(P);
for (auto P : Label->getPatterns()) {
if (!IntersectsRange(P->getSourceRange()))
checkPattern(P);
}
}
visit(S->getBody());
}