本文整理汇总了C#中IKVM.Internal.MethodWrapper.GetMethod方法的典型用法代码示例。如果您正苦于以下问题:C# MethodWrapper.GetMethod方法的具体用法?C# MethodWrapper.GetMethod怎么用?C# MethodWrapper.GetMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Internal.MethodWrapper
的用法示例。
在下文中一共展示了MethodWrapper.GetMethod方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokeNonVirtual
private static object InvokeNonVirtual(ManagedJNIEnv env, MethodWrapper mw, object obj, object[] argarray)
{
if (mw.HasCallerID || mw.IsDynamicOnly)
{
throw new NotSupportedException();
}
if (mw.DeclaringType.IsRemapped && !mw.DeclaringType.TypeAsBaseType.IsInstanceOfType(obj))
{
return mw.InvokeNonvirtualRemapped(obj, argarray);
}
else
{
Delegate del = (Delegate)Activator.CreateInstance(mw.GetDelegateType(),
new object[] { obj, mw.GetMethod().MethodHandle.GetFunctionPointer() });
try
{
return del.DynamicInvoke(argarray);
}
catch (TargetInvocationException x)
{
throw ikvm.runtime.Util.mapException(x.InnerException);
}
}
}
示例2: GetParameterAnnotations
internal override object[][] GetParameterAnnotations(MethodWrapper mw)
{
MethodBase mb = mw.GetMethod();
if (mb == null)
{
return null;
}
ParameterInfo[] parameters = mb.GetParameters();
object[][] attribs = new object[parameters.Length][];
for (int i = 0; i < parameters.Length; i++)
{
attribs[i] = parameters[i].GetCustomAttributes(false);
}
return attribs;
}
示例3: GetMethodAnnotations
internal override object[] GetMethodAnnotations(MethodWrapper mw)
{
MethodBase mb = mw.GetMethod();
if (mb == null)
{
return null;
}
return mb.GetCustomAttributes(false);
}
示例4: GetMethodParameters
internal override MethodParametersEntry[] GetMethodParameters(MethodWrapper mw)
{
MethodBase mb = mw.GetMethod();
if (mb == null)
{
return null;
}
ParameterInfo[] parameters = mb.GetParameters();
if (parameters.Length == 0)
{
return null;
}
MethodParametersEntry[] mp = new MethodParametersEntry[parameters.Length];
bool hasName = false;
for (int i = 0; i < mp.Length; i++)
{
string name = parameters[i].Name;
bool empty = String.IsNullOrEmpty(name);
if (empty)
{
name = "arg" + i;
}
mp[i].name = name;
hasName |= !empty;
}
if (!hasName)
{
return null;
}
return mp;
}
示例5: BaseFinalMethodWrapper
internal BaseFinalMethodWrapper(DotNetTypeWrapper tw, MethodWrapper m)
: base(tw, m.Name, m.Signature, m.GetMethod(), m.ReturnType, m.GetParameters(), (m.Modifiers & ~Modifiers.Abstract) | Modifiers.Final, MemberFlags.None)
{
this.m = m;
}
示例6: EmitDispatch
private static void EmitDispatch(DynamicTypeWrapper.FinishContext context, TypeWrapper[] args, TypeBuilder tb, MethodWrapper interfaceMethod, TypeWrapper[] implParameters,
ClassFile.ConstantPoolItemMethodHandle implMethod, ClassFile.ConstantPoolItemMethodType instantiatedMethodType, FieldBuilder[] capturedFields)
{
MethodBuilder mb = interfaceMethod.GetDefineMethodHelper().DefineMethod(context.TypeWrapper, tb, interfaceMethod.Name, MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.NewSlot | MethodAttributes.Final);
if (interfaceMethod.Name != interfaceMethod.RealName)
{
tb.DefineMethodOverride(mb, (MethodInfo)interfaceMethod.GetMethod());
}
CodeEmitter ilgen = CodeEmitter.Create(mb);
for (int i = 0; i < capturedFields.Length; i++)
{
ilgen.EmitLdarg(0);
OpCode opc = OpCodes.Ldfld;
if (i == 0 && args[0].IsGhost)
{
switch (implMethod.Kind)
{
case ClassFile.RefKind.invokeInterface:
case ClassFile.RefKind.invokeVirtual:
case ClassFile.RefKind.invokeSpecial:
opc = OpCodes.Ldflda;
break;
}
}
ilgen.Emit(opc, capturedFields[i]);
}
for (int i = 0, count = interfaceMethod.GetParameters().Length, k = capturedFields.Length; i < count; i++)
{
ilgen.EmitLdarg(i + 1);
TypeWrapper Ui = interfaceMethod.GetParameters()[i];
TypeWrapper Ti = instantiatedMethodType.GetArgTypes()[i];
TypeWrapper Aj = implParameters[i + k];
if (Ui == PrimitiveTypeWrapper.BYTE)
{
ilgen.Emit(OpCodes.Conv_I1);
}
if (Ti != Ui)
{
if (Ti.IsGhost)
{
Ti.EmitConvStackTypeToSignatureType(ilgen, Ui);
}
else if (Ui.IsGhost)
{
Ui.EmitConvSignatureTypeToStackType(ilgen);
}
else
{
Ti.EmitCheckcast(ilgen);
}
}
if (Ti != Aj)
{
if (Ti.IsPrimitive && !Aj.IsPrimitive)
{
Boxer.EmitBox(ilgen, Ti);
}
else if (!Ti.IsPrimitive && Aj.IsPrimitive)
{
TypeWrapper primitive = GetPrimitiveFromWrapper(Ti);
Boxer.EmitUnbox(ilgen, primitive, false);
if (primitive == PrimitiveTypeWrapper.BYTE)
{
ilgen.Emit(OpCodes.Conv_I1);
}
}
else if (Aj == PrimitiveTypeWrapper.LONG)
{
ilgen.Emit(OpCodes.Conv_I8);
}
else if (Aj == PrimitiveTypeWrapper.FLOAT)
{
ilgen.Emit(OpCodes.Conv_R4);
}
else if (Aj == PrimitiveTypeWrapper.DOUBLE)
{
ilgen.Emit(OpCodes.Conv_R8);
}
}
}
switch (implMethod.Kind)
{
case ClassFile.RefKind.invokeVirtual:
case ClassFile.RefKind.invokeInterface:
((MethodWrapper)implMethod.Member).EmitCallvirt(ilgen);
break;
case ClassFile.RefKind.newInvokeSpecial:
((MethodWrapper)implMethod.Member).EmitNewobj(ilgen);
break;
case ClassFile.RefKind.invokeStatic:
case ClassFile.RefKind.invokeSpecial:
((MethodWrapper)implMethod.Member).EmitCall(ilgen);
break;
default:
throw new InvalidOperationException();
}
TypeWrapper Ru = interfaceMethod.ReturnType;
TypeWrapper Ra = GetImplReturnType(implMethod);
TypeWrapper Rt = instantiatedMethodType.GetRetType();
if (Ra == PrimitiveTypeWrapper.BYTE)
//.........这里部分代码省略.........