Antlr4.Runtime.Tree.Trees.GetAncestors C# (CSharp) Method

GetAncestors() private method

private GetAncestors ( ITree t ) : IList
t ITree
return IList
        public static IList<ITree> GetAncestors(ITree t)
        {
            if (t.Parent == null)
            {
                return Collections.EmptyList<ITree>();
            }
            IList<ITree> ancestors = new List<ITree>();
            t = t.Parent;
            while (t != null)
            {
                ancestors.Insert(0, t);
                // insert at start
                t = t.Parent;
            }
            return ancestors;
        }