本文整理汇总了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(",");
}
}
}
}
示例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(",");
}
}
}
示例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(",");
}
}
}
示例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();
}
}
}
示例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();
}
}