internal ParameterSymbolKey(IParameterSymbol symbol, Visitor visitor) { this.containerKey = GetOrCreate(symbol.ContainingSymbol, visitor); this.metadataName = symbol.MetadataName; }
public static SymbolKey GetSymbolKey(this ISymbol?symbol, CancellationToken cancellationToken = default) => SymbolKey.Create(symbol, cancellationToken);
/// <summary> /// <para> /// When comparing symbols we need to handle recursion between method type parameters and /// methods. For example, if we have two methods with the signature <c><![CDATA[Foo<T>(T t)]]></c> and we /// try to test for equality we must avoid the situation where we: /// <list type="number"> /// <item>First test if the methods are the same, which will in turn</item> /// <item>test if the method's parameter types are the same, which will in turn</item> /// <item>test if the type parameters are the same, which will in turn</item> /// <item>test if the methods are the same, which causes infinite recursion.</item> /// </list> /// To avoid this we distinguish the cases where we're testing if two type parameters /// actually refer to the same thing, versus type parameters being referenced by parameters. /// For example, if we have: /// <code><![CDATA[ /// Foo<T>(T t) /// Bar<T>(T t) /// ]]></code> /// then clearly the type parameter <c>T</c> in <c><![CDATA[Foo<T>]]></c> is different from the type parameter <c>T</c> /// in <c><![CDATA[Bar<T>]]></c>. When testing these type parameters for equality we *will* test to see /// if they have the same parent. This will end up returning false, and so we will consider /// them different. /// </para> /// <para> /// However, when we are testing if two signatures are the same, if we hit a method type /// parameter then we only need to compare by metadataName. That's because we know we'll /// already have checked if the method and it's parents are the same, so we don't need to /// recurse through them again. /// </para> /// </summary> internal abstract bool Equals(SymbolKey other, ComparisonOptions options);
public PointerTypeSymbolKey(IPointerTypeSymbol symbol, Visitor visitor) { _pointedAtKey = GetOrCreate(symbol.PointedAtType, visitor); }
public TypeParameterSymbolKey(ITypeParameterSymbol symbol, Visitor visitor) { _containerKey = GetOrCreate(symbol.ContainingSymbol, visitor); _metadataName = symbol.MetadataName; }
public static SymbolKey GetSymbolKey(this ISymbol symbol) { return(SymbolKey.Create(symbol, CancellationToken.None)); }
public int GetHashCode(SymbolKey obj) => obj.GetHashCode();
internal NamespaceSymbolKey(INamespaceSymbol symbol, Visitor visitor) { _containerKeyOpt = DetermineContainerKey(symbol, visitor); _metadataName = symbol.MetadataName; }
internal override bool Equals(SymbolKey other, ComparisonOptions options) { return(ReferenceEquals(this, other)); }
internal static SymbolKey GetSymbolKey(this ISymbol symbol, Compilation compilation, CancellationToken cancellationToken) { return(SymbolKey.Create(symbol, compilation, cancellationToken)); }
internal ModuleSymbolKey(IModuleSymbol symbol, Visitor visitor) { _containerKey = GetOrCreate(symbol.ContainingSymbol, visitor); _metadataName = symbol.MetadataName; }