Skip to content

Commit

Permalink
Add cancellation checks
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Dec 29, 2020
1 parent 16d2766 commit 8a55725
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ private static void AnalyzeBinaryExpression(SyntaxNodeAnalysisContext context)

while (true)
{
context.CancellationToken.ThrowIfCancellationRequested();

ExpressionSyntax left = binaryExpression.Left;
SyntaxToken token = binaryExpression.OperatorToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ private static void AnalyzeExpression(SyntaxNodeAnalysisContext context)

do
{
context.CancellationToken.ThrowIfCancellationRequested();

SyntaxKind kind = en.Current.Kind();

if (kind == SyntaxKind.SimpleMemberAccessExpression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ private static void Analyze<TNode>(

for (int i = nodes.Count - 1; i >= 0; i--)
{
context.CancellationToken.ThrowIfCancellationRequested();

SyntaxTriviaList trailing = (i == 0)
? openNodeOrToken.GetTrailingTrivia()
: nodes.GetSeparator(i - 1).TrailingTrivia;
Expand Down

0 comments on commit 8a55725

Please sign in to comment.