当前位置: 首页>>代码示例>>C#>>正文


C# TypeDesc.GetClosestMetadataType方法代码示例

本文整理汇总了C#中Internal.TypeSystem.TypeDesc.GetClosestMetadataType方法的典型用法代码示例。如果您正苦于以下问题:C# TypeDesc.GetClosestMetadataType方法的具体用法?C# TypeDesc.GetClosestMetadataType怎么用?C# TypeDesc.GetClosestMetadataType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Internal.TypeSystem.TypeDesc的用法示例。


在下文中一共展示了TypeDesc.GetClosestMetadataType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppendVirtualSlots

        private void AppendVirtualSlots(StringBuilder sb, TypeDesc implType, TypeDesc declType)
        {
            var baseType = declType.BaseType;
            if (baseType != null)
                AppendVirtualSlots(sb, implType, baseType);

            List<MethodDesc> virtualSlots;
            _compilation.NodeFactory.VirtualSlots.TryGetValue(declType, out virtualSlots);
            if (virtualSlots != null)
            {
                for (int i = 0; i < virtualSlots.Count; i++)
                {
                    MethodDesc declMethod = virtualSlots[i];
                    MethodDesc implMethod = VirtualFunctionResolution.FindVirtualFunctionTargetMethodOnObjectType(declMethod, implType.GetClosestMetadataType());

                    if (implMethod.IsAbstract)
                    {
                        sb.Append("NULL,");
                    }
                    else
                    {
                        sb.Append("(void*)&");
                        sb.Append(GetCppTypeName(implMethod.OwningType));
                        sb.Append("::");
                        sb.Append(GetCppMethodName(implMethod));
                        sb.Append(",");
                    }
                }
            }
        }
开发者ID:xier2012,项目名称:corert,代码行数:30,代码来源:CppWriter.cs

示例2: AppendVirtualSlots

        private void AppendVirtualSlots(CppGenerationBuffer sb, TypeDesc implType, TypeDesc declType)
        {
            var baseType = declType.BaseType;
            if (baseType != null)
                AppendVirtualSlots(sb, implType, baseType);

            IReadOnlyList<MethodDesc> virtualSlots = _compilation.NodeFactory.VTable(declType).Slots;
            for (int i = 0; i < virtualSlots.Count; i++)
            {
                MethodDesc declMethod = virtualSlots[i];
                MethodDesc implMethod = implType.GetClosestMetadataType().FindVirtualFunctionTargetMethodOnObjectType(declMethod);

                sb.AppendLine();
                if (implMethod.IsAbstract)
                {
                    sb.Append("NULL,");
                }
                else
                {
                    sb.Append("(void*)&");
                    sb.Append(GetCppMethodDeclarationName(implMethod.OwningType, GetCppMethodName(implMethod)));
                    sb.Append(",");
                }
            }
        }
开发者ID:shahid-pk,项目名称:corert,代码行数:25,代码来源:CppWriter.cs

示例3: AppendVirtualSlots

        private void AppendVirtualSlots(StringBuilder sb, TypeDesc implType, TypeDesc declType)
        {
            var baseType = declType.BaseType;
            if (baseType != null)
                AppendVirtualSlots(sb, implType, baseType);

            var reg = _compilation.GetRegisteredType(declType);
            if (reg.VirtualSlots != null)
            {
                for (int i = 0; i < reg.VirtualSlots.Count; i++)
                {
                    MethodDesc declMethod = reg.VirtualSlots[i];
                    MethodDesc implMethod = VirtualFunctionResolution.FindVirtualFunctionTargetMethodOnObjectType(declMethod, implType.GetClosestMetadataType());

                    sb.Append("(void*)&");
                    sb.Append(GetCppTypeName(implMethod.OwningType));
                    sb.Append("::");
                    sb.Append(GetCppMethodName(implMethod));
                    sb.Append(",");
                }
            }
        }
开发者ID:morganbr,项目名称:corert,代码行数:22,代码来源:CppWriter.cs

示例4: OutputVirtualSlots

        private void OutputVirtualSlots(NodeFactory factory, ref ObjectDataBuilder objData, TypeDesc implType, TypeDesc declType)
        {
            var baseType = declType.BaseType;
            if (baseType != null)
                OutputVirtualSlots(factory, ref objData, implType, baseType);

            List<MethodDesc> virtualSlots;
            factory.VirtualSlots.TryGetValue(declType, out virtualSlots);

            if (virtualSlots != null)
            {
                for (int i = 0; i < virtualSlots.Count; i++)
                {
                    MethodDesc declMethod = virtualSlots[i];
                    MethodDesc implMethod = VirtualFunctionResolution.FindVirtualFunctionTargetMethodOnObjectType(declMethod, implType.GetClosestMetadataType());

                    if (!implMethod.IsAbstract)
                        objData.EmitPointerReloc(factory.MethodEntrypoint(implMethod));
                    else
                        objData.EmitZeroPointer();
                }
            }
        }
开发者ID:modulexcite,项目名称:corert,代码行数:23,代码来源:EETypeNode.cs

示例5: OutputVirtualSlots

        private void OutputVirtualSlots(NodeFactory factory, ref ObjectDataBuilder objData, TypeDesc implType, TypeDesc declType)
        {
            declType = declType.GetClosestMetadataType();

            var baseType = declType.BaseType;
            if (baseType != null)
                OutputVirtualSlots(factory, ref objData, implType, baseType);

            IReadOnlyList<MethodDesc> virtualSlots = factory.VTable(declType).Slots;
            
            for (int i = 0; i < virtualSlots.Count; i++)
            {
                MethodDesc declMethod = virtualSlots[i];
                MethodDesc implMethod = implType.GetClosestMetadataType().FindVirtualFunctionTargetMethodOnObjectType(declMethod);

                if (declMethod.HasInstantiation)
                {
                    // Generic virtual methods will "compile", but will fail to link. Check for it here.
                    throw new NotImplementedException("VTable for " + _type + " has generic virtual methods.");
                }

                if (!implMethod.IsAbstract)
                    objData.EmitPointerReloc(factory.MethodEntrypoint(implMethod, implMethod.OwningType.IsValueType));
                else
                    objData.EmitZeroPointer();
            }
        }
开发者ID:shahid-pk,项目名称:corert,代码行数:27,代码来源:EETypeNode.cs


注:本文中的Internal.TypeSystem.TypeDesc.GetClosestMetadataType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。