public override object VisitMethod(IMethodSymbol methodSymbol)
            {
                if (!methodSymbol.Equals(methodSymbol.ConstructedFrom))
                {
                    WriteType(SymbolKeyType.ConstructedMethod);
                    ConstructedMethodSymbolKey.Create(methodSymbol, this);
                }
                else
                {
                    switch (methodSymbol.MethodKind)
                    {
                    case MethodKind.ReducedExtension:
                        WriteType(SymbolKeyType.ReducedExtensionMethod);
                        ReducedExtensionMethodSymbolKey.Create(methodSymbol, this);
                        break;

                    case MethodKind.AnonymousFunction:
                        WriteType(SymbolKeyType.AnonymousFunctionOrDelegate);
                        AnonymousFunctionOrDelegateSymbolKey.Create(methodSymbol, this);
                        break;

                    case MethodKind.LocalFunction:
                        WriteType(SymbolKeyType.BodyLevel);
                        BodyLevelSymbolKey.Create(methodSymbol, this);
                        break;

                    default:
                        WriteType(SymbolKeyType.Method);
                        MethodSymbolKey.Create(methodSymbol, this);
                        break;
                    }
                }

                return(null);
            }
Exemplo n.º 2
0
            public override object VisitMethod(IMethodSymbol methodSymbol)
            {
                if (!methodSymbol.Equals(methodSymbol.ConstructedFrom))
                {
                    WriteType(SymbolKeyType.ConstructedMethod);
                    ConstructedMethodSymbolKey.Create(methodSymbol, this);
                }
                else if (methodSymbol.MethodKind == MethodKind.ReducedExtension)
                {
                    WriteType(SymbolKeyType.ReducedExtensionMethod);
                    ReducedExtensionMethodSymbolKey.Create(methodSymbol, this);
                }
                else if (methodSymbol.MethodKind == MethodKind.AnonymousFunction)
                {
                    WriteType(SymbolKeyType.AnonymousFunctionOrDelegate);
                    AnonymousFunctionOrDelegateSymbolKey.Create(methodSymbol, this);
                }
                else
                {
                    WriteType(SymbolKeyType.Method);
                    MethodSymbolKey.Create(methodSymbol, this);
                }

                return(null);
            }
            public override void VisitMethod(IMethodSymbol methodSymbol)
            {
                if (!methodSymbol.Equals(methodSymbol.ConstructedFrom))
                {
                    WriteType(SymbolKeyType.ConstructedMethod);
                    ConstructedMethodSymbolKey.Create(methodSymbol, this);
                }
                else
                {
                    switch (methodSymbol.MethodKind)
                    {
                    case MethodKind.ReducedExtension:
                        WriteType(SymbolKeyType.ReducedExtensionMethod);
                        ReducedExtensionMethodSymbolKey.Create(methodSymbol, this);
                        break;

                    case MethodKind.AnonymousFunction:
                        WriteType(SymbolKeyType.AnonymousFunctionOrDelegate);
                        AnonymousFunctionOrDelegateSymbolKey.Create(methodSymbol, this);
                        break;

                    case MethodKind.LocalFunction:
                        throw ExceptionUtilities.Unreachable;

                    default:
                        WriteType(SymbolKeyType.Method);
                        MethodSymbolKey.Create(methodSymbol, this);
                        break;
                    }
                }
            }
Exemplo n.º 4
0
            private SymbolKeyResolution ReadWorker(SymbolKeyType type)
            {
                switch (type)
                {
                case SymbolKeyType.Alias: return(AliasSymbolKey.Resolve(this));

                case SymbolKeyType.BodyLevel: return(BodyLevelSymbolKey.Resolve(this));

                case SymbolKeyType.ConstructedMethod: return(ConstructedMethodSymbolKey.Resolve(this));

                case SymbolKeyType.NamedType: return(NamedTypeSymbolKey.Resolve(this));

                case SymbolKeyType.ErrorType: return(ErrorTypeSymbolKey.Resolve(this));

                case SymbolKeyType.Field: return(FieldSymbolKey.Resolve(this));

                case SymbolKeyType.DynamicType: return(DynamicTypeSymbolKey.Resolve(this));

                case SymbolKeyType.Method: return(MethodSymbolKey.Resolve(this));

                case SymbolKeyType.Namespace: return(NamespaceSymbolKey.Resolve(this));

                case SymbolKeyType.PointerType: return(PointerTypeSymbolKey.Resolve(this));

                case SymbolKeyType.Parameter: return(ParameterSymbolKey.Resolve(this));

                case SymbolKeyType.Property: return(PropertySymbolKey.Resolve(this));

                case SymbolKeyType.ArrayType: return(ArrayTypeSymbolKey.Resolve(this));

                case SymbolKeyType.Assembly: return(AssemblySymbolKey.Resolve(this));

                case SymbolKeyType.TupleType: return(TupleTypeSymbolKey.Resolve(this));

                case SymbolKeyType.Module: return(ModuleSymbolKey.Resolve(this));

                case SymbolKeyType.Event: return(EventSymbolKey.Resolve(this));

                case SymbolKeyType.ReducedExtensionMethod: return(ReducedExtensionMethodSymbolKey.Resolve(this));

                case SymbolKeyType.TypeParameter: return(TypeParameterSymbolKey.Resolve(this));

                case SymbolKeyType.AnonymousType: return(AnonymousTypeSymbolKey.Resolve(this));

                case SymbolKeyType.AnonymousFunctionOrDelegate: return(AnonymousFunctionOrDelegateSymbolKey.Resolve(this));

                case SymbolKeyType.TypeParameterOrdinal: return(TypeParameterOrdinalSymbolKey.Resolve(this));
                }

                throw new NotImplementedException();
            }
Exemplo n.º 5
0
            protected override int ReadWorker(SymbolKeyType type)
            {
                switch (type)
                {
                case SymbolKeyType.Alias: return(AliasSymbolKey.GetHashCode(this));

                case SymbolKeyType.BodyLevel: return(BodyLevelSymbolKey.GetHashCode(this));

                case SymbolKeyType.ConstructedMethod: return(ConstructedMethodSymbolKey.GetHashCode(this));

                case SymbolKeyType.NamedType: return(NamedTypeSymbolKey.GetHashCode(this));

                case SymbolKeyType.ErrorType: return(ErrorTypeSymbolKey.GetHashCode(this));

                case SymbolKeyType.Field: return(FieldSymbolKey.GetHashCode(this));

                case SymbolKeyType.DynamicType: return(DynamicTypeSymbolKey.GetHashCode(this));

                case SymbolKeyType.Method: return(MethodSymbolKey.GetHashCode(this));

                case SymbolKeyType.Namespace: return(NamespaceSymbolKey.GetHashCode(this));

                case SymbolKeyType.PointerType: return(PointerTypeSymbolKey.GetHashCode(this));

                case SymbolKeyType.Parameter: return(ParameterSymbolKey.GetHashCode(this));

                case SymbolKeyType.Property: return(PropertySymbolKey.GetHashCode(this));

                case SymbolKeyType.ArrayType: return(ArrayTypeSymbolKey.GetHashCode(this));

                case SymbolKeyType.Assembly: return(AssemblySymbolKey.GetHashCode(this));

                case SymbolKeyType.TupleType: return(TupleTypeSymbolKey.GetHashCode(this));

                case SymbolKeyType.Module: return(ModuleSymbolKey.GetHashCode(this));

                case SymbolKeyType.Event: return(EventSymbolKey.GetHashCode(this));

                case SymbolKeyType.ReducedExtensionMethod: return(ReducedExtensionMethodSymbolKey.GetHashCode(this));

                case SymbolKeyType.TypeParameter: return(TypeParameterSymbolKey.GetHashCode(this));

                case SymbolKeyType.TypeParameterOrdinal: return(TypeParameterOrdinalSymbolKey.GetHashCode(this));
                }

                throw new NotImplementedException();
            }