/// <inheritdoc />
        public bool Equals(TypeSignature x, TypeSignature y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }
            if (ReferenceEquals(x, null) || ReferenceEquals(y, null))
            {
                return(false);
            }

            return(x switch
            {
                CorLibTypeSignature corLibType => Equals(corLibType, y as CorLibTypeSignature),
                TypeDefOrRefSignature typeDefOrRef => Equals(typeDefOrRef, y as TypeDefOrRefSignature),
                SzArrayTypeSignature szArrayType => Equals(szArrayType, y as SzArrayTypeSignature),
                ArrayTypeSignature arrayType => Equals(arrayType, y as ArrayTypeSignature),
                ByReferenceTypeSignature byRefType => Equals(byRefType, y as ByReferenceTypeSignature),
                BoxedTypeSignature boxedType => Equals(boxedType, y as BoxedTypeSignature),
                GenericInstanceTypeSignature genericInstanceType => Equals(genericInstanceType, y as GenericInstanceTypeSignature),
                GenericParameterSignature genericParameter => Equals(genericParameter, y as GenericParameterSignature),
                PointerTypeSignature pointerType => Equals(pointerType, y as PointerTypeSignature),
                PinnedTypeSignature pinnedType => Equals(pinnedType, y as PinnedTypeSignature),
                CustomModifierTypeSignature modifierType => Equals(modifierType, y as CustomModifierTypeSignature),
                _ => throw new NotSupportedException()
            });
Exemplo n.º 2
0
 /// <inheritdoc />
 public int GetHashCode(CustomModifierTypeSignature obj)
 {
     unchecked
     {
         int hashCode = (int)obj.ElementType << ElementTypeOffset;
         hashCode = (hashCode * 397) ^ (obj.ModifierType != null ? obj.ModifierType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (obj.BaseType != null ? obj.BaseType.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 3
0
        /// <inheritdoc />
        public bool Equals(CustomModifierTypeSignature x, CustomModifierTypeSignature y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }
            if (x is null || y is null)
            {
                return(false);
            }

            return(x.IsRequired == y.IsRequired &&
                   Equals(x.ModifierType, y.ModifierType) &&
                   Equals(x.BaseType, y.BaseType));
        }
Exemplo n.º 4
0
 /// <inheritdoc />
 public object VisitCustomModifierType(CustomModifierTypeSignature signature) => throw new NotSupportedException();
Exemplo n.º 5
0
 /// <inheritdoc />
 public TypeMemoryLayout VisitCustomModifierType(CustomModifierTypeSignature signature) =>
 signature.BaseType.AcceptVisitor(this);