示例#1
0
        public static ITypeInfo CreateFrom(ITypeSymbol typeSymbol, Compilation compilation)
        {
            typeSymbol.EnsureNotError();

            return(typeSymbol switch
            {
                IArrayTypeSymbol array => new SymbolArrayTypeInfo(array, compilation),
                INamedTypeSymbol named when named.TypeArguments.Any() /*ne IsGenericType legyen*/ => new SymbolGenericTypeInfo(named, compilation),
                _ => new SymbolTypeInfo(typeSymbol, compilation)
            });
示例#2
0
        public static ITypeInfo CreateFrom(ITypeSymbol typeSymbol, Compilation compilation)
        {
            typeSymbol.EnsureNotError();

            return(typeSymbol switch
            {
                IArrayTypeSymbol array => new SymbolArrayTypeInfo(array, compilation),
                INamedTypeSymbol named when named.TypeArguments.Some() /*ne IsGenericType legyen*/ => new SymbolGenericTypeInfo(named, compilation),

                //
                // NET6_0 workaround
                //

                _ when typeSymbol.Kind is SymbolKind.FunctionPointerType => CreateFrom
                (
                    compilation.GetTypeByMetadataName(typeof(IntPtr).FullName) !,
                    compilation
                ),
                _ => new SymbolTypeInfo(typeSymbol, compilation)
            });