Skip to content

Commit 44e4488

Browse files
committed
AST: Simplify usesFeatureTypedThrows().
NFC.
1 parent 65e8ce5 commit 44e4488

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

lib/AST/FeatureSet.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -356,24 +356,12 @@ static bool usesFeatureExtensionMacroAttr(Decl *decl) {
356356

357357
static bool usesFeatureTypedThrows(Decl *decl) {
358358
if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
359-
struct Walker : public TypeWalker {
360-
bool hasTypedThrows = false;
361-
362-
Action walkToTypePre(Type ty) override {
363-
if (auto funcType = ty->getAs<AnyFunctionType>()) {
364-
if (funcType->hasThrownError()) {
365-
hasTypedThrows = true;
366-
return Action::Stop;
367-
}
368-
}
369-
370-
return Action::Continue;
371-
}
372-
};
359+
return usesTypeMatching(decl, [](Type ty) {
360+
if (auto funcType = ty->getAs<AnyFunctionType>())
361+
return funcType->hasThrownError();
373362

374-
Walker walker;
375-
func->getInterfaceType().walk(walker);
376-
return walker.hasTypedThrows;
363+
return false;
364+
});
377365
}
378366

379367
return false;

0 commit comments

Comments
 (0)