本文整理汇总了C#中Mono.Cecil.ImportGenericContext.Push方法的典型用法代码示例。如果您正苦于以下问题:C# ImportGenericContext.Push方法的具体用法?C# ImportGenericContext.Push怎么用?C# ImportGenericContext.Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Cecil.ImportGenericContext
的用法示例。
在下文中一共展示了ImportGenericContext.Push方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportField
public FieldReference ImportField(FieldReference field, ImportGenericContext context)
{
var declaring_type = ImportType (field.DeclaringType, context);
context.Push (declaring_type);
try {
return new FieldReference {
Name = field.Name,
DeclaringType = declaring_type,
FieldType = ImportType (field.FieldType, context),
};
} finally {
context.Pop ();
}
}
示例2: ImportMethod
public MethodReference ImportMethod(MethodReference method, ImportGenericContext context)
{
if (method.IsGenericInstance)
return ImportMethodSpecification (method, context);
var declaring_type = ImportType (method.DeclaringType, context);
var reference = new MethodReference {
Name = method.Name,
HasThis = method.HasThis,
ExplicitThis = method.ExplicitThis,
DeclaringType = declaring_type,
CallingConvention = method.CallingConvention,
};
if (method.HasGenericParameters)
ImportGenericParameters (reference, method);
context.Push (reference);
try {
reference.ReturnType = ImportType (method.ReturnType, context);
if (!method.HasParameters)
return reference;
var reference_parameters = reference.Parameters;
var parameters = method.Parameters;
for (int i = 0; i < parameters.Count; i++)
reference_parameters.Add (
new ParameterDefinition (ImportType (parameters [i].ParameterType, context)));
return reference;
} finally {
context.Pop();
}
}
示例3: ImportMethodSpecification
MethodReference ImportMethodSpecification(SR.MethodBase method, ImportGenericContext context)
{
var method_info = method as SR.MethodInfo;
if (method_info == null)
throw new InvalidOperationException ();
var element_method = ImportMethod (method_info.GetGenericMethodDefinition (), context, ImportGenericKind.Definition);
var instance = new GenericInstanceMethod (element_method);
var arguments = method.GetGenericArguments ();
var instance_arguments = instance.GenericArguments;
context.Push (element_method);
try {
for (int i = 0; i < arguments.Length; i++)
instance_arguments.Add (ImportType (arguments [i], context));
return instance;
} finally {
context.Pop ();
}
}
示例4: ImportGenericInstance
TypeReference ImportGenericInstance(Type type, ImportGenericContext context)
{
var element_type = ImportType (type.GetGenericTypeDefinition (), context, ImportGenericKind.Definition);
var instance = new GenericInstanceType (element_type);
var arguments = type.GetGenericArguments ();
var instance_arguments = instance.GenericArguments;
context.Push (element_type);
try {
for (int i = 0; i < arguments.Length; i++)
instance_arguments.Add (ImportType (arguments [i], context));
return instance;
} finally {
context.Pop ();
}
}
示例5: ImportField
internal FieldReference ImportField(FieldReference field, ImportGenericContext context,
IImportMapper mapper)
{
var mapped = mapper.MapField(field);
if (mapped == null)
mapped = field;
var declaring_type = ImportType(mapped.DeclaringType, context, mapper);
context.Push (declaring_type);
try {
return new FieldReference {
Name = mapped.Name,
DeclaringType = declaring_type,
FieldType = ImportType(mapped.FieldType, context, mapper),
};
} finally {
context.Pop ();
}
}