@@ -8949,7 +8949,8 @@ namespace {
89498949 PreWalkResult<Expr *> walkToExprPre (Expr *expr) override {
89508950 // For closures, update the parameter types and check the body.
89518951 if (auto closure = dyn_cast<ClosureExpr>(expr)) {
8952- rewriteFunction (closure);
8952+ if (rewriteFunction (closure))
8953+ return Action::Stop ();
89538954
89548955 if (AnyFunctionRef (closure).hasExternalPropertyWrapperParameters ()) {
89558956 auto *thunkTy = Rewriter.cs .getType (closure)->castTo <FunctionType>();
@@ -8962,19 +8963,22 @@ namespace {
89628963 }
89638964
89648965 if (auto *SVE = dyn_cast<SingleValueStmtExpr>(expr)) {
8965- rewriteSingleValueStmtExpr (SVE);
8966+ if (rewriteSingleValueStmtExpr (SVE))
8967+ return Action::Stop ();
89668968 return Action::SkipNode (SVE);
89678969 }
89688970
89698971 if (auto tap = dyn_cast_or_null<TapExpr>(expr)) {
8970- rewriteTapExpr (tap);
8972+ if (rewriteTapExpr (tap))
8973+ return Action::Stop ();
89718974 return Action::SkipNode (tap);
89728975 }
89738976
89748977 if (auto captureList = dyn_cast<CaptureListExpr>(expr)) {
89758978 // Rewrite captures.
89768979 for (const auto &capture : captureList->getCaptureList ()) {
8977- (void )rewriteTarget (SyntacticElementTarget (capture.PBD ));
8980+ if (!rewriteTarget (SyntacticElementTarget (capture.PBD )))
8981+ return Action::Stop ();
89788982 }
89798983 }
89808984
@@ -9000,31 +9004,36 @@ namespace {
90009004 return Action::SkipNode ();
90019005 }
90029006
9003- NullablePtr<Pattern>
9004- rewritePattern (Pattern *pattern, DeclContext *DC);
9007+ [[nodiscard]]
9008+ NullablePtr<Pattern> rewritePattern (Pattern *pattern, DeclContext *DC);
90059009
90069010 // / Rewrite the target, producing a new target.
9011+ [[nodiscard]]
90079012 std::optional<SyntacticElementTarget>
90089013 rewriteTarget (SyntacticElementTarget target) override ;
90099014
90109015 // / Rewrite the function for the given solution.
90119016 // /
90129017 // / \returns true if an error occurred.
9018+ [[nodiscard]]
90139019 bool rewriteFunction (AnyFunctionRef fn) {
90149020 return Rewriter.cs .applySolution (fn, *this );
90159021 }
90169022
9023+ [[nodiscard]]
90179024 bool rewriteSingleValueStmtExpr (SingleValueStmtExpr *SVE) {
90189025 return Rewriter.cs .applySolutionToSingleValueStmt (SVE, *this );
90199026 }
90209027
9021- void rewriteTapExpr (TapExpr *tap) {
9028+ [[nodiscard]]
9029+ bool rewriteTapExpr (TapExpr *tap) {
90229030 // First, let's visit the tap expression itself
90239031 // and set all of the inferred types.
9024- Rewriter.visitTapExpr (tap);
9032+ if (!Rewriter.visitTapExpr (tap))
9033+ return true ;
90259034
90269035 // Now, let's apply solution to the body
9027- ( void ) Rewriter.cs .applySolutionToBody (tap, *this );
9036+ return Rewriter.cs .applySolutionToBody (tap, *this );
90289037 }
90299038 };
90309039} // end anonymous namespace
0 commit comments