Exemplo n.º 1
0
        internal static CilType DecodeType(EntityHandle handle, CilTypeProvider provider, bool?isValueType)
        {
            SignatureTypeHandleCode code;

            if (isValueType.HasValue)
            {
                code = isValueType.Value ? SignatureTypeHandleCode.ValueType : SignatureTypeHandleCode.Class;
            }
            else
            {
                code = SignatureTypeHandleCode.Unresolved;
            }

            switch (handle.Kind)
            {
            case HandleKind.TypeDefinition:
                return(provider.GetTypeFromDefinition(provider.Reader, (TypeDefinitionHandle)handle, code));

            case HandleKind.TypeReference:
                return(provider.GetTypeFromReference(provider.Reader, (TypeReferenceHandle)handle, code));

            case HandleKind.TypeSpecification:
                return(provider.GetTypeFromSpecification(provider.Reader, (TypeSpecificationHandle)handle, code));

            default:
                throw new ArgumentException("Handle is not a type definition, reference, or specification.", nameof(handle));
            }
        }
Exemplo n.º 2
0
        internal static CilType DecodeType(EntityHandle handle, CilTypeProvider provider, byte rawTypeKind)
        {
            switch (handle.Kind)
            {
            case HandleKind.TypeDefinition:
                return(provider.GetTypeFromDefinition(provider.Reader, (TypeDefinitionHandle)handle, rawTypeKind));

            case HandleKind.TypeReference:
                return(provider.GetTypeFromReference(provider.Reader, (TypeReferenceHandle)handle, rawTypeKind));

            case HandleKind.TypeSpecification:
                return(provider.GetTypeFromSpecification(provider.Reader, null, (TypeSpecificationHandle)handle, rawTypeKind));

            default:
                throw new ArgumentException("Handle is not a type definition, reference, or specification.", nameof(handle));
            }
        }
Exemplo n.º 3
0
        internal static CilType DecodeType(EntityHandle handle, CilTypeProvider provider, bool? isValueType)
        {
            SignatureTypeHandleCode code;
            if (isValueType.HasValue)
            {
                code = isValueType.Value ? SignatureTypeHandleCode.ValueType : SignatureTypeHandleCode.Class;
            }
            else
            {
                code = SignatureTypeHandleCode.Unresolved;
            }

            switch (handle.Kind)
            {
                case HandleKind.TypeDefinition:
                    return provider.GetTypeFromDefinition(provider.Reader, (TypeDefinitionHandle)handle, code);
                case HandleKind.TypeReference:
                    return provider.GetTypeFromReference(provider.Reader, (TypeReferenceHandle)handle, code);
                case HandleKind.TypeSpecification:
                    return provider.GetTypeFromSpecification(provider.Reader, (TypeSpecificationHandle)handle, code);
                default:
                    throw new ArgumentException("Handle is not a type definition, reference, or specification.", nameof(handle));
            }
        }