public override object VisitNamedType(INamedTypeSymbol namedTypeSymbol)
            {
                if (namedTypeSymbol.TypeKind == TypeKind.Error)
                {
                    WriteType(SymbolKeyType.ErrorType);
                    ErrorTypeSymbolKey.Create(namedTypeSymbol, this);
                }
                else if (namedTypeSymbol.IsTupleType)
                {
                    WriteType(SymbolKeyType.TupleType);
                    TupleTypeSymbolKey.Create(namedTypeSymbol, this);
                }
                else if (namedTypeSymbol.IsAnonymousType)
                {
                    if (namedTypeSymbol.IsAnonymousDelegateType())
                    {
                        WriteType(SymbolKeyType.AnonymousFunctionOrDelegate);
                        AnonymousFunctionOrDelegateSymbolKey.Create(namedTypeSymbol, this);
                    }
                    else
                    {
                        WriteType(SymbolKeyType.AnonymousType);
                        AnonymousTypeSymbolKey.Create(namedTypeSymbol, this);
                    }
                }
                else
                {
                    WriteType(SymbolKeyType.NamedType);
                    NamedTypeSymbolKey.Create(namedTypeSymbol, this);
                }

                return(null);
            }
            public override object VisitNamedType(INamedTypeSymbol namedTypeSymbol)
            {
                if (namedTypeSymbol.TypeKind == TypeKind.Error)
                {
                    WriteType(SymbolKeyType.ErrorType);
                    ErrorTypeSymbolKey.Create(namedTypeSymbol, this);
                }
                else if (namedTypeSymbol.IsTupleType)
                {
                    WriteType(SymbolKeyType.TupleType);
                    TupleTypeSymbolKey.Create(namedTypeSymbol, this);
                }
                else
                {
                    WriteType(SymbolKeyType.NamedType);
                    NamedTypeSymbolKey.Create(namedTypeSymbol, this);
                }

                return(null);
            }
예제 #3
0
            public override object VisitNamedType(INamedTypeSymbol namedTypeSymbol)
            {
                if (namedTypeSymbol.TypeKind == TypeKind.Error)
                {
                    WriteType(SymbolKeyType.ErrorType);
                    ErrorTypeSymbolKey.Create(namedTypeSymbol, this);
                }
                else if (namedTypeSymbol.IsTupleType && namedTypeSymbol.TupleUnderlyingType != namedTypeSymbol)
                {
                    // A tuple is a named type with some added information
                    // We only need to store this extra information if there is some
                    // (ie. the current type differs from the underlying type, which has no element names)
                    WriteType(SymbolKeyType.TupleType);
                    TupleTypeSymbolKey.Create(namedTypeSymbol, this);
                }
                else if (namedTypeSymbol.IsAnonymousType)
                {
                    if (namedTypeSymbol.IsAnonymousDelegateType())
                    {
                        WriteType(SymbolKeyType.AnonymousFunctionOrDelegate);
                        AnonymousFunctionOrDelegateSymbolKey.Create(namedTypeSymbol, this);
                    }
                    else
                    {
                        WriteType(SymbolKeyType.AnonymousType);
                        AnonymousTypeSymbolKey.Create(namedTypeSymbol, this);
                    }
                }
                else
                {
                    WriteType(SymbolKeyType.NamedType);
                    NamedTypeSymbolKey.Create(namedTypeSymbol, this);
                }

                return(null);
            }