@@ -160,13 +160,13 @@ void UsableFilteringDeclConsumer::foundDecl(ValueDecl *D,
160
160
}
161
161
162
162
switch (reason) {
163
- case DeclVisibilityKind::LocalVariable :
163
+ case DeclVisibilityKind::LocalDecl :
164
164
case DeclVisibilityKind::FunctionParameter:
165
165
// Skip if Loc is before the found decl if the decl is a var/let decl.
166
166
// Type and func decls can be referenced before its declaration, or from
167
167
// within nested type decls.
168
168
if (isa<VarDecl>(D)) {
169
- if (reason == DeclVisibilityKind::LocalVariable ) {
169
+ if (reason == DeclVisibilityKind::LocalDecl ) {
170
170
// Workaround for fast-completion. A loc in the current context might be
171
171
// in a loc
172
172
auto tmpLoc = Loc;
@@ -240,7 +240,7 @@ void UsableFilteringDeclConsumer::foundDecl(ValueDecl *D,
240
240
return ;
241
241
242
242
switch (shadowingReason) {
243
- case DeclVisibilityKind::LocalVariable :
243
+ case DeclVisibilityKind::LocalDecl :
244
244
case DeclVisibilityKind::FunctionParameter:
245
245
// Local func and var/let with a conflicting name.
246
246
// func foo() {
@@ -251,7 +251,7 @@ void UsableFilteringDeclConsumer::foundDecl(ValueDecl *D,
251
251
// So, for confilicting local values in the same decl context, even if the
252
252
// 'var value' is reported after 'func value', don't shadow it, but we
253
253
// shadow everything with the name after that.
254
- if (reason == DeclVisibilityKind::LocalVariable &&
254
+ if (reason == DeclVisibilityKind::LocalDecl &&
255
255
isa<VarDecl>(D) && !isa<VarDecl>(shadowingD) &&
256
256
shadowingD->getDeclContext () == D->getDeclContext ()) {
257
257
// Replace the shadowing decl so we shadow subsequent conflicting decls.
@@ -3980,7 +3980,7 @@ void FindLocalVal::checkStmtCondition(const StmtCondition &Cond) {
3980
3980
if (auto *P = entry.getPatternOrNull ()) {
3981
3981
SourceRange previousConditionsToHere = SourceRange (start, entry.getEndLoc ());
3982
3982
if (!isReferencePointInRange (previousConditionsToHere))
3983
- checkPattern (P, DeclVisibilityKind::LocalVariable );
3983
+ checkPattern (P, DeclVisibilityKind::LocalDecl );
3984
3984
}
3985
3985
}
3986
3986
}
@@ -4030,7 +4030,7 @@ void FindLocalVal::visitForEachStmt(ForEachStmt *S) {
4030
4030
return ;
4031
4031
visit (S->getBody ());
4032
4032
if (!isReferencePointInRange (S->getParsedSequence ()->getSourceRange ()))
4033
- checkPattern (S->getPattern (), DeclVisibilityKind::LocalVariable );
4033
+ checkPattern (S->getPattern (), DeclVisibilityKind::LocalDecl );
4034
4034
}
4035
4035
4036
4036
void FindLocalVal::visitBraceStmt (BraceStmt *S, bool isTopLevelCode) {
@@ -4074,7 +4074,7 @@ void FindLocalVal::visitBraceStmt(BraceStmt *S, bool isTopLevelCode) {
4074
4074
std::function<void (Decl *)> visitDecl;
4075
4075
visitDecl = [&](Decl *D) {
4076
4076
if (auto *VD = dyn_cast<ValueDecl>(D))
4077
- checkValueDecl (VD, DeclVisibilityKind::LocalVariable );
4077
+ checkValueDecl (VD, DeclVisibilityKind::LocalDecl );
4078
4078
D->visitAuxiliaryDecls (visitDecl);
4079
4079
};
4080
4080
for (auto elem : S->getElements ()) {
@@ -4124,15 +4124,15 @@ void FindLocalVal::visitCaseStmt(CaseStmt *S) {
4124
4124
for (const auto &CLI : items) {
4125
4125
auto guard = CLI.getGuardExpr ();
4126
4126
if (guard && isReferencePointInRange (guard->getSourceRange ())) {
4127
- checkPattern (CLI.getPattern (), DeclVisibilityKind::LocalVariable );
4127
+ checkPattern (CLI.getPattern (), DeclVisibilityKind::LocalDecl );
4128
4128
break ;
4129
4129
}
4130
4130
}
4131
4131
}
4132
4132
4133
4133
if (!inPatterns && !items.empty ()) {
4134
4134
for (auto *vd : S->getCaseBodyVariablesOrEmptyArray ()) {
4135
- checkValueDecl (vd, DeclVisibilityKind::LocalVariable );
4135
+ checkValueDecl (vd, DeclVisibilityKind::LocalDecl );
4136
4136
}
4137
4137
}
4138
4138
visit (S->getBody ());
0 commit comments