Exemplo n.º 1
0
            internal override bool Equals(TypeSymbol t2, TypeCompareKind comparison)
            {
                if (ReferenceEquals(this, t2))
                {
                    return(true);
                }

                // if ignoring dynamic, then treat dynamic the same as the type 'object'
                if ((comparison & TypeCompareKind.IgnoreDynamic) != 0 &&
                    (object)t2 != null &&
                    t2.TypeKind == TypeKind.Dynamic &&
                    this.SpecialType == Microsoft.CodeAnalysis.SpecialType.System_Object)
                {
                    return(true);
                }

                var other = t2 as TopLevel;

#if XSHARP
                return((object)other != null &&
                       XSharpString.Equals(MetadataName, other.MetadataName) &&
                       arity == other.arity &&
                       XSharpString.Equals(_namespaceName, other.NamespaceName) &&
                       _containingModule.Equals(other._containingModule));
#else
                return((object)other != null &&
                       string.Equals(MetadataName, other.MetadataName, StringComparison.Ordinal) &&
                       arity == other.arity &&
                       string.Equals(_namespaceName, other.NamespaceName, StringComparison.Ordinal) &&
                       _containingModule.Equals(other._containingModule));
#endif
            }
Exemplo n.º 2
0
            internal override bool Equals(TypeSymbol t2, TypeCompareKind comparison, IReadOnlyDictionary <TypeParameterSymbol, bool>?isValueTypeOverrideOpt = null)
            {
                if (ReferenceEquals(this, t2))
                {
                    return(true);
                }

                // if ignoring dynamic, then treat dynamic the same as the type 'object'
                if ((comparison & TypeCompareKind.IgnoreDynamic) != 0 &&
                    (object)t2 != null &&
                    t2.TypeKind == TypeKind.Dynamic &&
                    this.SpecialType == Microsoft.CodeAnalysis.SpecialType.System_Object)
                {
                    return(true);
                }

                var other = t2 as TopLevel;

                if (other is null)
                {
                    return(false);
                }

                if ((comparison & TypeCompareKind.IgnoreNativeIntegers) == 0 &&
                    _isNativeInt != other._isNativeInt)
                {
                    return(false);
                }

                return(string.Equals(MetadataName, other.MetadataName, StringComparison.Ordinal) &&
                       arity == other.arity &&
                       string.Equals(_namespaceName, other.NamespaceName, StringComparison.Ordinal) &&
                       _containingModule.Equals(other._containingModule));
            }
            internal override bool Equals(TypeSymbol t2, bool ignoreCustomModifiers, bool ignoreDynamic)
            {
                if (ReferenceEquals(this, t2))
                {
                    return(true);
                }

                // if ignoring dynamic, then treat dynamic the same as the type 'object'
                if (ignoreDynamic &&
                    (object)t2 != null &&
                    t2.TypeKind == TypeKind.DynamicType &&
                    this.SpecialType == Microsoft.CodeAnalysis.SpecialType.System_Object)
                {
                    return(true);
                }

                var other = t2 as TopLevel;

                return((object)other != null &&
                       string.Equals(MetadataName, other.MetadataName, StringComparison.Ordinal) &&
                       arity == other.arity &&
                       string.Equals(namespaceName, other.NamespaceName, StringComparison.Ordinal) &&
                       containingModule.Equals(other.containingModule));
            }