コード例 #1
0
 internal ParameterSymbolKey(IParameterSymbol symbol, Visitor visitor)
 {
     this.containerKey = GetOrCreate(symbol.ContainingSymbol, visitor);
     this.metadataName = symbol.MetadataName;
 }
コード例 #2
0
 public static SymbolKey GetSymbolKey(this ISymbol?symbol, CancellationToken cancellationToken = default)
 => SymbolKey.Create(symbol, cancellationToken);
コード例 #3
0
 /// <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);
コード例 #4
0
 public PointerTypeSymbolKey(IPointerTypeSymbol symbol, Visitor visitor)
 {
     _pointedAtKey = GetOrCreate(symbol.PointedAtType, visitor);
 }
コード例 #5
0
 public TypeParameterSymbolKey(ITypeParameterSymbol symbol, Visitor visitor)
 {
     _containerKey = GetOrCreate(symbol.ContainingSymbol, visitor);
     _metadataName = symbol.MetadataName;
 }
コード例 #6
0
 public static SymbolKey GetSymbolKey(this ISymbol symbol)
 {
     return(SymbolKey.Create(symbol, CancellationToken.None));
 }
コード例 #7
0
 public int GetHashCode(SymbolKey obj)
 => obj.GetHashCode();
コード例 #8
0
 internal NamespaceSymbolKey(INamespaceSymbol symbol, Visitor visitor)
 {
     _containerKeyOpt = DetermineContainerKey(symbol, visitor);
     _metadataName    = symbol.MetadataName;
 }
コード例 #9
0
 internal override bool Equals(SymbolKey other, ComparisonOptions options)
 {
     return(ReferenceEquals(this, other));
 }
コード例 #10
0
 internal static SymbolKey GetSymbolKey(this ISymbol symbol, Compilation compilation, CancellationToken cancellationToken)
 {
     return(SymbolKey.Create(symbol, compilation, cancellationToken));
 }
コード例 #11
0
 internal ModuleSymbolKey(IModuleSymbol symbol, Visitor visitor)
 {
     _containerKey = GetOrCreate(symbol.ContainingSymbol, visitor);
     _metadataName = symbol.MetadataName;
 }