Example #1
0
        private static IEnumerable <ITypeSymbol> InnerGetNestedCustomDeserializerTypes(
            IPropertyFinder finder,
            INamedTypeSymbol type,
            IList <ITypeSymbol> foundTypes,
            IList <ITypeSymbol> exploredTypes
            )
        {
            var writingProperties = finder.GetWritingProperties(type);
            var readingProperties = finder.GetReadingProperties(type);

            var firstLevelNestedTypes = writingProperties
                                        .Concat(readingProperties)
                                        .Select(p =>
            {
                var t = p.Property.FindCustomDeserializerType();

                if (t == null)
                {
                    return(p);
                }

                foundTypes.AddDistinct(t);
                return(null);
            })
                                        .Trim()
                                        .FilterTypes(exploredTypes);


            return(firstLevelNestedTypes.Concat(
                       firstLevelNestedTypes
                       .OfType <INamedTypeSymbol>()
                       .SelectMany(t => InnerGetNestedCustomDeserializerTypes(finder, t, foundTypes, exploredTypes))
                       .OfType <ITypeSymbol>()
                       ));
        }
Example #2
0
        private static IEnumerable <ITypeSymbol> InnerGetNestedTypes(IPropertyFinder finder, INamedTypeSymbol type, IList <ITypeSymbol> alreadyFoundTypes)
        {
            var writingProperties = finder.GetWritingProperties(type);
            var readingProperties = finder.GetReadingProperties(type);

            var firstLevelNestedTypes = writingProperties
                                        .Concat(readingProperties)
                                        .FilterTypes(alreadyFoundTypes);

            return(firstLevelNestedTypes
                   .Concat(firstLevelNestedTypes.OfType <INamedTypeSymbol>().SelectMany(t => InnerGetNestedTypes(finder, t, alreadyFoundTypes))));
        }