Ejemplo n.º 1
0
        public static bool IsAncestorOf(IParseTree a, IParseTree b)
        {
            if (a == null)
            {
                throw new ArgumentNullException("a");
            }
            if (b == null)
            {
                throw new ArgumentNullException("b");
            }

            for (IParseTree current = b;
                 current != null;
                 current = current.Parent)
            {
                if (current.Equals(a))
                {
                    return(true);
                }
            }

            return(false);
        }