本文整理汇总了C#中IKVM.Internal.MethodWrapper.GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# MethodWrapper.GetParameters方法的具体用法?C# MethodWrapper.GetParameters怎么用?C# MethodWrapper.GetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IKVM.Internal.MethodWrapper
的用法示例。
在下文中一共展示了MethodWrapper.GetParameters方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddParameterMetadata
private void AddParameterMetadata(MethodBuilder method, MethodWrapper mw)
{
ParameterBuilder[] pbs;
if((mw.DeclaringType.IsPublic && (mw.IsPublic || mw.IsProtected)) || classLoader.EmitDebugInfo)
{
string[] parameterNames = new string[mw.GetParameters().Length];
GetParameterNamesFromXml(mw.Name, mw.Signature, parameterNames);
GetParameterNamesFromSig(mw.Signature, parameterNames);
pbs = GetParameterBuilders(method, parameterNames.Length, parameterNames);
}
else
{
pbs = GetParameterBuilders(method, mw.GetParameters().Length, null);
}
if((mw.Modifiers & Modifiers.VarArgs) != 0 && pbs.Length > 0)
{
AttributeHelper.SetParamArrayAttribute(pbs[pbs.Length - 1]);
}
AddXmlMapParameterAttributes(method, Name, mw.Name, mw.Signature, ref pbs);
}
示例2: InvokeArgsProcessor
internal InvokeArgsProcessor(MethodWrapper mw, MethodBase method, object original_obj, object[] original_args, [email protected] callerID)
{
TypeWrapper[] argTypes = mw.GetParameters();
if(!mw.IsStatic && method.IsStatic && mw.Name != "<init>")
{
// we've been redirected to a static method, so we have to copy the 'obj' into the args
object[] nargs = new object[original_args.Length + 1];
nargs[0] = original_obj;
original_args.CopyTo(nargs, 1);
this.obj = null;
this.args = nargs;
for(int i = 0; i < argTypes.Length; i++)
{
if(!argTypes[i].IsUnloadable && argTypes[i].IsGhost)
{
object v = Activator.CreateInstance(argTypes[i].TypeAsSignatureType);
argTypes[i].GhostRefField.SetValue(v, args[i + 1]);
args[i + 1] = v;
}
}
}
else
{
this.obj = original_obj;
this.args = original_args;
for(int i = 0; i < argTypes.Length; i++)
{
if(!argTypes[i].IsUnloadable && argTypes[i].IsGhost)
{
if(this.args == original_args)
{
this.args = (object[])args.Clone();
}
object v = Activator.CreateInstance(argTypes[i].TypeAsSignatureType);
argTypes[i].GhostRefField.SetValue(v, args[i]);
this.args[i] = v;
}
}
}
if(mw.HasCallerID)
{
object[] nargs = new object[args.Length + 1];
Array.Copy(args, nargs, args.Length);
nargs[args.Length] = callerID;
args = nargs;
}
}
示例3: 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;
}
示例4: MatchSignatures
private static bool MatchSignatures(MethodWrapper mw1, MethodWrapper mw2)
{
return mw1.ReturnType == mw2.ReturnType
&& MatchTypes(mw1.GetParameters(), mw2.GetParameters());
}
示例5: 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)
//.........这里部分代码省略.........
示例6: JsrMethodAnalyzer
internal JsrMethodAnalyzer(MethodWrapper mw, ClassFile classFile, ClassFile.Method method, ClassLoaderWrapper classLoader, InstructionFlags[] flags)
{
if (method.VerifyError != null)
{
throw new VerifyError(method.VerifyError);
}
this.classFile = classFile;
state = new InstructionState[method.Instructions.Length];
callsites = new List<int>[method.Instructions.Length];
returnsites = new List<int>[method.Instructions.Length];
// because types have to have identity, the subroutine return address types are cached here
Dictionary<int, SimpleType> returnAddressTypes = new Dictionary<int, SimpleType>();
try
{
// ensure that exception blocks and handlers start and end at instruction boundaries
for (int i = 0; i < method.ExceptionTable.Length; i++)
{
int start = method.ExceptionTable[i].startIndex;
int end = method.ExceptionTable[i].endIndex;
int handler = method.ExceptionTable[i].handlerIndex;
if (start >= end || start == -1 || end == -1 || handler <= 0)
{
throw new IndexOutOfRangeException();
}
}
}
catch (IndexOutOfRangeException)
{
throw new ClassFormatError(string.Format("Illegal exception table (class: {0}, method: {1}, signature: {2}", classFile.Name, method.Name, method.Signature));
}
// start by computing the initial state, the stack is empty and the locals contain the arguments
state[0] = new InstructionState(method.MaxLocals, method.MaxStack);
SimpleType thisType;
int firstNonArgLocalIndex = 0;
if (!method.IsStatic)
{
thisType = SimpleType.Object;
state[0].SetLocalType(firstNonArgLocalIndex++, thisType, -1);
}
else
{
thisType = null;
}
TypeWrapper[] argTypeWrappers = mw.GetParameters();
for (int i = 0; i < argTypeWrappers.Length; i++)
{
TypeWrapper tw = argTypeWrappers[i];
SimpleType type;
if (tw.IsWidePrimitive)
{
type = SimpleType.WidePrimitive;
}
else if (tw.IsPrimitive)
{
type = SimpleType.Primitive;
}
else
{
type = SimpleType.Object;
}
state[0].SetLocalType(firstNonArgLocalIndex++, type, -1);
if (type.IsWidePrimitive)
{
firstNonArgLocalIndex++;
}
}
SimpleType[] argumentsByLocalIndex = new SimpleType[firstNonArgLocalIndex];
for (int i = 0; i < argumentsByLocalIndex.Length; i++)
{
argumentsByLocalIndex[i] = state[0].GetLocalTypeEx(i);
}
InstructionState s = state[0].Copy();
bool done = false;
ClassFile.Method.Instruction[] instructions = method.Instructions;
while (!done)
{
done = true;
for (int i = 0; i < instructions.Length; i++)
{
if (state[i] != null && state[i].changed)
{
try
{
//Console.WriteLine(method.Instructions[i].PC + ": " + method.Instructions[i].OpCode.ToString());
done = false;
state[i].changed = false;
// mark the exception handlers reachable from this instruction
for (int j = 0; j < method.ExceptionTable.Length; j++)
{
if (method.ExceptionTable[j].startIndex <= i && i < method.ExceptionTable[j].endIndex)
{
MergeExceptionHandler(method.ExceptionTable[j].handlerIndex, state[i]);
}
}
state[i].CopyTo(s);
ClassFile.Method.Instruction instr = instructions[i];
//.........这里部分代码省略.........