@@ -476,8 +476,6 @@ class RangeWalker: protected ASTWalker {
476
476
}
477
477
478
478
PreWalkAction walkToDeclPre (Decl *D) override {
479
- // TODO: Can we use Action::Stop instead of Action::SkipChildren in this
480
- // function?
481
479
if (!walkCustomAttributes (D))
482
480
return Action::SkipChildren ();
483
481
@@ -504,32 +502,32 @@ class RangeWalker: protected ASTWalker {
504
502
if (SafeToAskForGenerics) {
505
503
if (auto *GP = GC->getParsedGenericParams ()) {
506
504
if (!handleAngles (GP->getLAngleLoc (), GP->getRAngleLoc (), ContextLoc))
507
- return Action::SkipChildren ();
505
+ return Action::Stop ();
508
506
}
509
507
}
510
508
}
511
509
512
510
if (auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
513
511
if (!handleBraces (NTD->getBraces (), ContextLoc))
514
- return Action::SkipChildren ();
512
+ return Action::Stop ();
515
513
} else if (auto *ED = dyn_cast<ExtensionDecl>(D)) {
516
514
if (!handleBraces (ED->getBraces (), ContextLoc))
517
- return Action::SkipChildren ();
515
+ return Action::Stop ();
518
516
} else if (auto *VD = dyn_cast<VarDecl>(D)) {
519
517
if (!handleBraces (VD->getBracesRange (), VD->getNameLoc ()))
520
- return Action::SkipChildren ();
518
+ return Action::Stop ();
521
519
} else if (isa<AbstractFunctionDecl>(D) || isa<SubscriptDecl>(D)) {
522
520
if (isa<SubscriptDecl>(D)) {
523
521
if (!handleBraces (cast<SubscriptDecl>(D)->getBracesRange (), ContextLoc))
524
- return Action::SkipChildren ();
522
+ return Action::Stop ();
525
523
}
526
524
auto *PL = getParameterList (cast<ValueDecl>(D));
527
525
if (!handleParens (PL->getLParenLoc (), PL->getRParenLoc (), ContextLoc))
528
- return Action::SkipChildren ();
526
+ return Action::Stop ();
529
527
} else if (auto *PGD = dyn_cast<PrecedenceGroupDecl>(D)) {
530
528
SourceRange Braces (PGD->getLBraceLoc (), PGD->getRBraceLoc ());
531
529
if (!handleBraces (Braces, ContextLoc))
532
- return Action::SkipChildren ();
530
+ return Action::Stop ();
533
531
} else if (auto *PDD = dyn_cast<PoundDiagnosticDecl>(D)) {
534
532
// TODO: add paren locations to PoundDiagnosticDecl
535
533
}
@@ -683,20 +681,18 @@ class RangeWalker: protected ASTWalker {
683
681
}
684
682
685
683
PreWalkAction walkToTypeReprPre (TypeRepr *T) override {
686
- // TODO: Can we use Action::Stop instead of Action::SkipChildren in this
687
- // function?
688
684
if (auto *TT = dyn_cast<TupleTypeRepr>(T)) {
689
685
SourceRange Parens = TT->getParens ();
690
686
if (!handleParens (Parens.Start , Parens.End , Parens.Start ))
691
- return Action::SkipChildren ();
687
+ return Action::Stop ();
692
688
} else if (isa<ArrayTypeRepr>(T) || isa<DictionaryTypeRepr>(T)) {
693
689
if (!handleSquares (T->getStartLoc (), T->getEndLoc (), T->getStartLoc ()))
694
- return Action::SkipChildren ();
690
+ return Action::Stop ();
695
691
} else if (auto *GI = dyn_cast<GenericIdentTypeRepr>(T)) {
696
692
SourceLoc ContextLoc = GI->getNameLoc ().getBaseNameLoc ();
697
693
SourceRange Brackets = GI->getAngleBrackets ();
698
694
if (!handleAngles (Brackets.Start , Brackets.End , ContextLoc))
699
- return Action::SkipChildren ();
695
+ return Action::Stop ();
700
696
}
701
697
return Action::Continue ();
702
698
}
0 commit comments