@@ -160,13 +160,13 @@ void UsableFilteringDeclConsumer::foundDecl(ValueDecl *D,
160160 }
161161
162162 switch (reason) {
163- case DeclVisibilityKind::LocalVariable :
163+ case DeclVisibilityKind::LocalDecl :
164164 case DeclVisibilityKind::FunctionParameter:
165165 // Skip if Loc is before the found decl if the decl is a var/let decl.
166166 // Type and func decls can be referenced before its declaration, or from
167167 // within nested type decls.
168168 if (isa<VarDecl>(D)) {
169- if (reason == DeclVisibilityKind::LocalVariable ) {
169+ if (reason == DeclVisibilityKind::LocalDecl ) {
170170 // Workaround for fast-completion. A loc in the current context might be
171171 // in a loc
172172 auto tmpLoc = Loc;
@@ -240,7 +240,7 @@ void UsableFilteringDeclConsumer::foundDecl(ValueDecl *D,
240240 return ;
241241
242242 switch (shadowingReason) {
243- case DeclVisibilityKind::LocalVariable :
243+ case DeclVisibilityKind::LocalDecl :
244244 case DeclVisibilityKind::FunctionParameter:
245245 // Local func and var/let with a conflicting name.
246246 // func foo() {
@@ -251,7 +251,7 @@ void UsableFilteringDeclConsumer::foundDecl(ValueDecl *D,
251251 // So, for confilicting local values in the same decl context, even if the
252252 // 'var value' is reported after 'func value', don't shadow it, but we
253253 // shadow everything with the name after that.
254- if (reason == DeclVisibilityKind::LocalVariable &&
254+ if (reason == DeclVisibilityKind::LocalDecl &&
255255 isa<VarDecl>(D) && !isa<VarDecl>(shadowingD) &&
256256 shadowingD->getDeclContext () == D->getDeclContext ()) {
257257 // Replace the shadowing decl so we shadow subsequent conflicting decls.
@@ -3980,7 +3980,7 @@ void FindLocalVal::checkStmtCondition(const StmtCondition &Cond) {
39803980 if (auto *P = entry.getPatternOrNull ()) {
39813981 SourceRange previousConditionsToHere = SourceRange (start, entry.getEndLoc ());
39823982 if (!isReferencePointInRange (previousConditionsToHere))
3983- checkPattern (P, DeclVisibilityKind::LocalVariable );
3983+ checkPattern (P, DeclVisibilityKind::LocalDecl );
39843984 }
39853985 }
39863986}
@@ -4030,7 +4030,7 @@ void FindLocalVal::visitForEachStmt(ForEachStmt *S) {
40304030 return ;
40314031 visit (S->getBody ());
40324032 if (!isReferencePointInRange (S->getParsedSequence ()->getSourceRange ()))
4033- checkPattern (S->getPattern (), DeclVisibilityKind::LocalVariable );
4033+ checkPattern (S->getPattern (), DeclVisibilityKind::LocalDecl );
40344034}
40354035
40364036void FindLocalVal::visitBraceStmt (BraceStmt *S, bool isTopLevelCode) {
@@ -4074,7 +4074,7 @@ void FindLocalVal::visitBraceStmt(BraceStmt *S, bool isTopLevelCode) {
40744074 std::function<void (Decl *)> visitDecl;
40754075 visitDecl = [&](Decl *D) {
40764076 if (auto *VD = dyn_cast<ValueDecl>(D))
4077- checkValueDecl (VD, DeclVisibilityKind::LocalVariable );
4077+ checkValueDecl (VD, DeclVisibilityKind::LocalDecl );
40784078 D->visitAuxiliaryDecls (visitDecl);
40794079 };
40804080 for (auto elem : S->getElements ()) {
@@ -4124,15 +4124,15 @@ void FindLocalVal::visitCaseStmt(CaseStmt *S) {
41244124 for (const auto &CLI : items) {
41254125 auto guard = CLI.getGuardExpr ();
41264126 if (guard && isReferencePointInRange (guard->getSourceRange ())) {
4127- checkPattern (CLI.getPattern (), DeclVisibilityKind::LocalVariable );
4127+ checkPattern (CLI.getPattern (), DeclVisibilityKind::LocalDecl );
41284128 break ;
41294129 }
41304130 }
41314131 }
41324132
41334133 if (!inPatterns && !items.empty ()) {
41344134 for (auto *vd : S->getCaseBodyVariablesOrEmptyArray ()) {
4135- checkValueDecl (vd, DeclVisibilityKind::LocalVariable );
4135+ checkValueDecl (vd, DeclVisibilityKind::LocalDecl );
41364136 }
41374137 }
41384138 visit (S->getBody ());
0 commit comments