File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -595,6 +595,12 @@ namespace swift {
595595 // / than this many seconds.
596596 unsigned ExpressionTimeoutThreshold = 600 ;
597597
598+ // / If the shared pointer is not a \c nullptr and the pointee is \c true,
599+ // / typechecking should be aborted at the next possible opportunity.
600+ // / This is used by SourceKit to cancel requests for which the result is no
601+ // / longer of interest.
602+ std::shared_ptr<bool > CancellationFlag = nullptr ;
603+
598604 // / If non-zero, abort the switch statement exhaustiveness checker if
599605 // / the Space::minus function is called more than this many times.
600606 // /
Original file line number Diff line number Diff line change @@ -5155,6 +5155,10 @@ class ConstraintSystem {
51555155 if (isExpressionAlreadyTooComplex)
51565156 return true ;
51575157
5158+ auto CancellationFlag = getASTContext ().TypeCheckerOpts .CancellationFlag ;
5159+ if (CancellationFlag && *CancellationFlag)
5160+ return true ;
5161+
51585162 auto used = getASTContext ().getSolverMemory () + solutionMemory;
51595163 MaxMemory = std::max (used, MaxMemory);
51605164 auto threshold = getASTContext ().TypeCheckerOpts .SolverMemoryThreshold ;
You can’t perform that action at this time.
0 commit comments