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); }
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(); }
public override object VisitNamedType(INamedTypeSymbol namedTypeSymbol) { if (namedTypeSymbol.TypeKind == TypeKind.Error) { WriteType(SymbolKeyType.ErrorType); ErrorTypeSymbolKey.Create(namedTypeSymbol, this); } else if (namedTypeSymbol.IsTupleType && namedTypeSymbol.TupleUnderlyingType is INamedTypeSymbol underlyingType && underlyingType != 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); }
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(); }
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); }