public static void Free(AwaitExpressionWalker walker)
        {
            walker._shouldVisit = true;
            walker.StopOnFirstAwaitExpression = false;
            walker.AwaitExpressions.Clear();

            _cachedInstance = walker;
        }
        public static AwaitExpressionWalker GetInstance()
        {
            AwaitExpressionWalker walker = _cachedInstance;

            if (walker != null)
            {
                Debug.Assert(walker.AwaitExpressions.Count == 0);

                _cachedInstance = null;
                return(walker);
            }

            return(new AwaitExpressionWalker());
        }
        public static AwaitExpressionWalker GetInstance()
        {
            AwaitExpressionWalker walker = _cachedInstance;

            if (walker != null)
            {
                _cachedInstance = null;
                return(walker);
            }
            else
            {
                return(new AwaitExpressionWalker());
            }
        }
        public static bool ContainsAwaitExpression(ExpressionSyntax expression)
        {
            AwaitExpressionWalker walker = GetInstance();

            walker.StopOnFirstAwaitExpression = true;
            walker.Visit(expression);

            Debug.Assert(walker.AwaitExpressions.Count <= 1);

            bool result = walker.AwaitExpressions.Count == 1;

            Free(walker);

            return(result);
        }
        public static void Free(AwaitExpressionWalker walker)
        {
            walker.Reset();

            _cachedInstance = walker;
        }