Ejemplo n.º 1
0
        public static bool AnyAncestor(this ClassType classType, ISymbolMap symbols, Func <ClassType, bool> predicate)
        {
            var current = classType.Base;

            while (current != null)
            {
                ClassType currentType = (ClassType)symbols.GetTypeFromFullyQualifiedName(current);

                if (predicate(currentType))
                {
                    return(true);
                }

                current = currentType.Base;
            }

            return(false);
        }
Ejemplo n.º 2
0
        static IEnumerable <T> GetAllCore <T>(this InterfaceType @interface, ISymbolMap symbols, Func <InterfaceType, IEnumerable <T> > selector)
        {
            foreach (T member in selector(@interface) ?? Enumerable.Empty <T>())
            {
                yield return(member);
            }

            if (@interface.Interfaces != null)
            {
                var baseMembers = @interface.Interfaces
                                  .Select(r => symbols.GetTypeFromFullyQualifiedName(r) as InterfaceType)
                                  .SelectMany(i => GetAllCore(i, symbols, selector));

                foreach (T member in baseMembers)
                {
                    yield return(member);
                }
            }
        }
Ejemplo n.º 3
0
 public static void MapFullyQualifiedNameToType(this ISymbolMap symbols, string fullyQualifiedName, Type type)
 {
     symbols
     .GetTypeFromFullyQualifiedName(Arg.Is <string>(n => n == fullyQualifiedName))
     .Returns(type);
 }