コード例 #1
0
        public static IEnumerable <SyntaxNode> GetThisAndParents(this SyntaxNode node, int?limit = null)
        {
            while (node != null)
            {
                CancellationTokenExtensions.ThrowOnCancellation();

                if (limit < 0)
                {
                    break;
                }

                yield return(node);

                node  = node.Parent;
                limit = limit - 1;
            }
        }