Esempio n. 1
0
 public void SetValues(TextSpan span, bool stopOnFirstAwaitExpression = false)
 {
     _shouldStop = false;
     Span        = span;
     StopOnFirstAwaitExpression = stopOnFirstAwaitExpression;
     AwaitExpressions.Clear();
 }
        public override void VisitAwaitExpression(AwaitExpressionSyntax node)
        {
            ShouldStop = true;

            if (StopOnFirstAwaitExpression)
            {
                Debug.Assert(AwaitExpressions.Count == 0);

                AwaitExpressions.Add(node);
            }
            else
            {
                AwaitExpressions.Clear();
            }
        }
        public override void VisitReturnStatement(ReturnStatementSyntax node)
        {
            Debug.Assert(!StopOnFirstAwaitExpression);

            if (node.Expression is AwaitExpressionSyntax awaitExpression)
            {
                Visit(awaitExpression.Expression);

                if (!ShouldStop)
                {
                    AwaitExpressions.Add(awaitExpression);
                }
            }
            else
            {
                ShouldStop = true;
                AwaitExpressions.Clear();
            }
        }
 public void Reset()
 {
     ShouldStop = false;
     StopOnFirstAwaitExpression = false;
     AwaitExpressions.Clear();
 }
 public void Reset()
 {
     _shouldVisit = true;
     StopOnFirstAwaitExpression = false;
     AwaitExpressions.Clear();
 }