本文整理汇总了C#中IKVM.Reflection.Emit.TypeBuilder.DefineMethodOverride方法的典型用法代码示例。如果您正苦于以下问题:C# TypeBuilder.DefineMethodOverride方法的具体用法?C# TypeBuilder.DefineMethodOverride怎么用?C# TypeBuilder.DefineMethodOverride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Reflection.Emit.TypeBuilder
的用法示例。
在下文中一共展示了TypeBuilder.DefineMethodOverride方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitMapXmlMetadata
//.........这里部分代码省略.........
}
}
}
}
}
if(clazz.Methods != null)
{
// HACK this isn't the right place to do this, but for now it suffices
foreach(IKVM.Internal.MapXml.Method method in clazz.Methods)
{
// are we adding a new method?
if(GetMethodWrapper(method.Name, method.Sig, false) == null)
{
if(method.body == null)
{
Console.Error.WriteLine("Error: Method {0}.{1}{2} in xml remap file doesn't have a body.", clazz.Name, method.Name, method.Sig);
continue;
}
bool setmodifiers = false;
MethodAttributes attribs = method.MethodAttributes;
MapModifiers(method.Modifiers, false, out setmodifiers, ref attribs);
Type returnType;
Type[] parameterTypes;
MapSignature(method.Sig, out returnType, out parameterTypes);
MethodBuilder mb = typeBuilder.DefineMethod(method.Name, attribs, returnType, parameterTypes);
if(setmodifiers)
{
AttributeHelper.SetModifiers(mb, (Modifiers)method.Modifiers, false);
}
if([email protected] != null)
{
MethodWrapper mw = GetClassLoader().LoadClassByDottedName([email protected]).GetMethodWrapper([email protected], method.Sig, true);
mw.Link();
typeBuilder.DefineMethodOverride(mb, (MethodInfo)mw.GetMethod());
}
CompilerClassLoader.AddDeclaredExceptions(mb, method.throws);
CodeEmitter ilgen = CodeEmitter.Create(mb);
method.Emit(classLoader, ilgen);
ilgen.DoEmit();
if(method.Attributes != null)
{
foreach(IKVM.Internal.MapXml.Attribute attr in method.Attributes)
{
AttributeHelper.SetCustomAttribute(classLoader, mb, attr);
}
}
}
}
foreach(IKVM.Internal.MapXml.Method method in clazz.Methods)
{
if(method.Attributes != null)
{
foreach(MethodWrapper mw in methods)
{
if(mw.Name == method.Name && mw.Signature == method.Sig)
{
MethodBuilder mb = mw.GetMethod() as MethodBuilder;
if(mb != null)
{
foreach(IKVM.Internal.MapXml.Attribute attr in method.Attributes)
{
AttributeHelper.SetCustomAttribute(classLoader, mb, attr);
}
}
}
}