Ejemplo n.º 1
0
		static DmdType GetEnumUnderlyingType(DmdType type) {
			if ((object)type == null)
				throw new CABlobParserException("null enum type");
			var td = type.ResolveNoThrow();
			if ((object)td == null)
				return null;
			if (!td.IsEnum)
				throw new CABlobParserException("Not an enum");
			return td.GetEnumUnderlyingType().WithoutCustomModifiers();
		}
Ejemplo n.º 2
0
		static ReadOnlyCollection<DmdType> GetGenericArguments(DmdType type) {
			if (!type.IsMetadataReference)
				return type.GetGenericArguments();

			var resolvedType = type.ResolveNoThrow();
			if ((object)resolvedType != null)
				return resolvedType.GetGenericArguments();

			return ReadOnlyCollectionHelpers.Empty<DmdType>();
		}
Ejemplo n.º 3
0
        DmdType?Resolve(IDmdAssemblyName?asmRef, DmdType typeRef)
        {
            var asm     = ownerModule !.Assembly;
            var asmName = asm.GetName();

            if (!DmdMemberInfoEqualityComparer.DefaultOther.Equals(asmRef, asmName))
            {
                return(null);
            }
            var td = typeRef.ResolveNoThrow();

            return(td?.Module == ownerModule ? td : null);
        }
Ejemplo n.º 4
0
        static ReadOnlyCollection <DmdType> GetGenericArguments(DmdType type)
        {
            if (!type.IsMetadataReference)
            {
                return(type.GetGenericArguments());
            }

            var resolvedType = type.ResolveNoThrow();

            if (!(resolvedType is null))
            {
                return(resolvedType.GetGenericArguments());
            }

            return(ReadOnlyCollectionHelpers.Empty <DmdType>());
        }
Ejemplo n.º 5
0
        static DmdType?GetEnumUnderlyingType(DmdType type)
        {
            if (type is null)
            {
                throw new CABlobParserException("null enum type");
            }
            var td = type.ResolveNoThrow();

            if (td is null)
            {
                return(null);
            }
            if (!td.IsEnum)
            {
                throw new CABlobParserException("Not an enum");
            }
            return(td.GetEnumUnderlyingType().WithoutCustomModifiers());
        }
Ejemplo n.º 6
0
 static DmdType TryResolve(DmdType member, DmdResolveOptions options) => (options & DmdResolveOptions.NoTryResolveRefs) != 0 ? member : member.ResolveNoThrow() ?? member;