本文整理汇总了C#中Mono.Cecil.TypeReference.ContainsGenericParameter方法的典型用法代码示例。如果您正苦于以下问题:C# TypeReference.ContainsGenericParameter方法的具体用法?C# TypeReference.ContainsGenericParameter怎么用?C# TypeReference.ContainsGenericParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.TypeReference
的用法示例。
在下文中一共展示了TypeReference.ContainsGenericParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildType
/// <summary>
/// Internal helper to actually builds the type.
/// </summary>
/// <param name="typeReference">The type definition.</param>
/// <returns></returns>
private Type BuildType(TypeReference typeReference)
{
if (typeReference.ContainsGenericParameter())
return null;
TypeRef dataType;
StackValueType stackType;
var valueType = TypeRef.Empty;
switch (typeReference.MetadataType)
{
case MetadataType.Pointer:
{
var type = GetType(((PointerType)typeReference).ElementType);
// Special case: void*
if (LLVM.VoidTypeInContext(context) == type.DataType)
dataType = intPtrType;
else
dataType = LLVM.PointerType(type.DataType, 0);
stackType = StackValueType.NativeInt;
break;
}
case MetadataType.ByReference:
{
var type = GetType(((ByReferenceType)typeReference).ElementType);
dataType = LLVM.PointerType(type.DefaultType, 0);
stackType = StackValueType.Reference;
break;
}
case MetadataType.RequiredModifier:
// TODO: Add support for this feature
return GetType(((RequiredModifierType)typeReference).ElementType);
case MetadataType.Void:
dataType = LLVM.VoidTypeInContext(context);
stackType = StackValueType.Unknown;
break;
case MetadataType.Boolean:
dataType = LLVM.Int8TypeInContext(context);
stackType = StackValueType.Int32;
break;
case MetadataType.Single:
dataType = LLVM.FloatTypeInContext(context);
stackType = StackValueType.Float;
break;
case MetadataType.Double:
dataType = LLVM.DoubleTypeInContext(context);
stackType = StackValueType.Float;
break;
case MetadataType.Char:
dataType = CharUsesUTF8
? LLVM.Int8TypeInContext(context)
: LLVM.Int16TypeInContext(context);
stackType = StackValueType.Int32;
break;
case MetadataType.Byte:
case MetadataType.SByte:
dataType = LLVM.Int8TypeInContext(context);
stackType = StackValueType.Int32;
break;
case MetadataType.Int16:
case MetadataType.UInt16:
dataType = LLVM.Int16TypeInContext(context);
stackType = StackValueType.Int32;
break;
case MetadataType.Int32:
case MetadataType.UInt32:
dataType = int32Type;
stackType = StackValueType.Int32;
break;
case MetadataType.Int64:
case MetadataType.UInt64:
dataType = int64Type;
stackType = StackValueType.Int64;
break;
case MetadataType.UIntPtr:
case MetadataType.IntPtr:
dataType = intPtrType;
stackType = StackValueType.NativeInt;
break;
case MetadataType.Array:
case MetadataType.String:
case MetadataType.TypedByReference:
case MetadataType.GenericInstance:
case MetadataType.ValueType:
case MetadataType.Class:
case MetadataType.Object:
{
// When resolved, void becomes a real type
if (typeReference.FullName == typeof(void).FullName)
{
goto case MetadataType.Void;
}
var typeDefinition = GetMethodTypeDefinition(typeReference);
if (typeDefinition.IsValueType && typeDefinition.IsEnum)
//.........这里部分代码省略.........