本文整理汇总了C#中IArgumentProvider.Map方法的典型用法代码示例。如果您正苦于以下问题:C# IArgumentProvider.Map方法的具体用法?C# IArgumentProvider.Map怎么用?C# IArgumentProvider.Map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IArgumentProvider
的用法示例。
在下文中一共展示了IArgumentProvider.Map方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitMethodCall
//CONFORMING
// assumes 'object' of non-static call is already on stack
private void EmitMethodCall(MethodInfo mi, IArgumentProvider args, Type objectType) {
// Emit arguments
List<WriteBack> wb = EmitArguments(mi, args);
// Emit the actual call
OpCode callOp = UseVirtual(mi) ? OpCodes.Callvirt : OpCodes.Call;
if (callOp == OpCodes.Callvirt && objectType.IsValueType) {
// This automatically boxes value types if necessary.
_ilg.Emit(OpCodes.Constrained, objectType);
}
if (mi.CallingConvention == CallingConventions.VarArgs) {
_ilg.EmitCall(callOp, mi, args.Map(a => a.Type));
} else {
_ilg.Emit(callOp, mi);
}
// Emit writebacks for properties passed as "ref" arguments
EmitWriteBack(wb);
}
示例2: EmitMethodCall
// assumes 'object' of non-static call is already on stack
private void EmitMethodCall(MethodInfo mi, IArgumentProvider args, Type objectType, CompilationFlags flags) {
// Emit arguments
List<WriteBack> wb = EmitArguments(mi, args);
// Emit the actual call
OpCode callOp = UseVirtual(mi) ? OpCodes.Callvirt : OpCodes.Call;
if (callOp == OpCodes.Callvirt && objectType.IsValueType) {
// This automatically boxes value types if necessary.
_ilg.Emit(OpCodes.Constrained, objectType);
}
// The method call can be a tail call if
// 1) the method call is the last instruction before Ret
// 2) the method does not have any ByRef parameters, refer to ECMA-335 Partition III Section 2.4.
// "Verification requires that no managed pointers are passed to the method being called, since
// it does not track pointers into the current frame."
if ((flags & CompilationFlags.EmitAsTailCallMask) == CompilationFlags.EmitAsTail && !MethodHasByRefParameter(mi)) {
_ilg.Emit(OpCodes.Tailcall);
}
if (mi.CallingConvention == CallingConventions.VarArgs) {
_ilg.EmitCall(callOp, mi, args.Map(a => a.Type));
} else {
_ilg.Emit(callOp, mi);
}
// Emit writebacks for properties passed as "ref" arguments
EmitWriteBack(wb);
}