/// <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()
            });
Example #2
0
 private BoxedTypeSignature ImportBoxedTypeSignature(BoxedTypeSignature signature)
 {
     return(new BoxedTypeSignature(ImportTypeSignature(signature.BaseType))
     {
         IsValueType = signature.IsValueType
     });
 }
Example #3
0
        /// <summary>
        /// Determines whether two types are considered equal according to their signature.
        /// </summary>
        /// <param name="signature1">The first type to compare.</param>
        /// <param name="signature2">The second type to compare.</param>
        /// <returns><c>True</c> if the types are considered equal, <c>False</c> otherwise.</returns>
        public bool Equals(BoxedTypeSignature signature1, BoxedTypeSignature signature2)
        {
            if (signature1 == null && signature2 == null)
            {
                return(true);
            }
            if (signature1 == null || signature2 == null)
            {
                return(false);
            }

            return(Equals(signature1.BaseType, signature2.BaseType));
        }
Example #4
0
 /// <inheritdoc />
 public int GetHashCode(BoxedTypeSignature obj) =>
 GetHashCode(obj as TypeSpecificationSignature);
Example #5
0
 /// <inheritdoc />
 public bool Equals(BoxedTypeSignature x, BoxedTypeSignature y) =>
 Equals(x as TypeSpecificationSignature, y);
Example #6
0
 /// <inheritdoc />
 public object VisitBoxedType(BoxedTypeSignature signature) => throw new NotSupportedException();
 public uint VisitBoxedType(BoxedTypeSignature signature) => PointerSize;
Example #8
0
 /// <inheritdoc />
 public TypeMemoryLayout VisitBoxedType(BoxedTypeSignature signature) =>
 new TypeMemoryLayout(signature, PointerSize);