Skip to content

Commit 10faede

Browse files
committed
Sema: Move dynamic replacement check from DeclChecker::visitVarDecl() to ::visitBoundVariable()
1 parent 8f29f76 commit 10faede

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,8 +2223,10 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
22232223
.fixItRemove(attr->getRange());
22242224
}
22252225
}
2226-
}
22272226

2227+
if (VD->getAttrs().hasAttribute<DynamicReplacementAttr>())
2228+
TC.checkDynamicReplacementAttribute(VD);
2229+
}
22282230

22292231
void visitBoundVars(Pattern *P) {
22302232
P->forEachVariable([&] (VarDecl *VD) { this->visitBoundVariable(VD); });
@@ -2845,12 +2847,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
28452847
void visitVarDecl(VarDecl *VD) {
28462848
// Delay type-checking on VarDecls until we see the corresponding
28472849
// PatternBindingDecl.
2848-
2849-
// Except if there is a dynamic replacement attribute.
2850-
if (VD->getAttrs().hasAttribute<DynamicReplacementAttr>()) {
2851-
TC.validateDecl(VD);
2852-
TC.checkDynamicReplacementAttribute(VD);
2853-
}
28542850
}
28552851

28562852
/// Determine whether the given declaration requires a definition.

0 commit comments

Comments
 (0)