@@ -130,7 +130,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
130130 // Must check this first in case extensions have not been bound yet
131131 if (Walker.shouldWalkIntoGenericParams ()) {
132132 if (auto *params = GC->getParsedGenericParams ()) {
133- visitGenericParamList (params);
133+ doIt (params);
134134 }
135135 return true ;
136136 }
@@ -252,7 +252,7 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
252252
253253 bool visitOpaqueTypeDecl (OpaqueTypeDecl *OTD) {
254254 if (Walker.shouldWalkIntoGenericParams () && OTD->getGenericParams ()) {
255- if (visitGenericParamList (OTD->getGenericParams ()))
255+ if (doIt (OTD->getGenericParams ()))
256256 return true ;
257257 }
258258 return false ;
@@ -439,22 +439,6 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
439439 return false ;
440440 }
441441
442- bool visitGenericParamList (GenericParamList *GPL) {
443- // Visit generic params
444- for (auto &P : GPL->getParams ()) {
445- if (doIt (P))
446- return true ;
447- }
448-
449- // Visit param conformance
450- for (auto Req : GPL->getRequirements ()) {
451- if (doIt (Req))
452- return true ;
453- }
454-
455- return false ;
456- }
457-
458442 // ===--------------------------------------------------------------------===//
459443 // Exprs
460444 // ===--------------------------------------------------------------------===//
@@ -1342,12 +1326,28 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
13421326 return true ;
13431327 break ;
13441328 case RequirementReprKind::LayoutConstraint:
1345- if (doIt (Req.getFirstTypeRepr ()))
1329+ if (doIt (Req.getSubjectRepr ()))
13461330 return true ;
13471331 break ;
13481332 }
13491333 return false ;
13501334 }
1335+
1336+ bool doIt (GenericParamList *GPL) {
1337+ // Visit generic params
1338+ for (auto &P : GPL->getParams ()) {
1339+ if (doIt (P))
1340+ return true ;
1341+ }
1342+
1343+ // Visit param conformance
1344+ for (auto Req : GPL->getRequirements ()) {
1345+ if (doIt (Req))
1346+ return true ;
1347+ }
1348+
1349+ return false ;
1350+ }
13511351};
13521352
13531353} // end anonymous namespace
@@ -1877,3 +1877,7 @@ StmtConditionElement *StmtConditionElement::walk(ASTWalker &walker) {
18771877bool Decl::walk (ASTWalker &walker) {
18781878 return Traversal (walker).doIt (this );
18791879}
1880+
1881+ bool GenericParamList::walk (ASTWalker &walker) {
1882+ return Traversal (walker).doIt (this );
1883+ }
0 commit comments