Exemplo n.º 1
0
        private static RQUnconstructedType BuildNamedType(INamedTypeSymbol type)
        {
            // Anything that is a valid RQUnconstructed types is ALWAYS safe for public APIs

            if (type == null)
            {
                return(null);
            }

            // Anonymous types are unsupported
            if (type.IsAnonymousType)
            {
                return(null);
            }

            // the following types are supported for BuildType() used in signatures, but are not supported
            // for UnconstructedTypes
            if (type != type.ConstructedFrom || type.SpecialType == SpecialType.System_Void)
            {
                return(null);
            }

            // make an RQUnconstructedType
            var namespaceNames = RQNodeBuilder.GetNameParts(@type.ContainingNamespace);
            var typeInfos      = new List <RQUnconstructedTypeInfo>();

            for (var currentType = type; currentType != null; currentType = currentType.ContainingType)
            {
                typeInfos.Insert(0, new RQUnconstructedTypeInfo(currentType.Name, currentType.TypeParameters.Length));
            }

            return(new RQUnconstructedType(namespaceNames, typeInfos));
        }
Exemplo n.º 2
0
 private static RQNamespace BuildNamespace(INamespaceSymbol @namespace)
 {
     return(new RQNamespace(RQNodeBuilder.GetNameParts(@namespace)));
 }