本文整理汇总了C#中Mono.CSharp.EmitContext.EmitArgumentLoad方法的典型用法代码示例。如果您正苦于以下问题:C# EmitContext.EmitArgumentLoad方法的具体用法?C# EmitContext.EmitArgumentLoad怎么用?C# EmitContext.EmitArgumentLoad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.EmitContext
的用法示例。
在下文中一共展示了EmitContext.EmitArgumentLoad方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitAddressOf
public void EmitAddressOf (EmitContext ec)
{
if ((ModFlags & Modifier.RefOutMask) != 0) {
ec.EmitArgumentLoad (idx);
} else {
ec.EmitArgumentAddress (idx);
}
}
示例2: DefineProxy
/// <summary>
/// C# allows this kind of scenarios:
/// interface I { void M (); }
/// class X { public void M (); }
/// class Y : X, I { }
///
/// For that case, we create an explicit implementation function
/// I.M in Y.
/// </summary>
void DefineProxy (TypeSpec iface, MethodSpec base_method, MethodSpec iface_method)
{
// TODO: Handle nested iface names
string proxy_name;
var ns = iface.MemberDefinition.Namespace;
if (string.IsNullOrEmpty (ns))
proxy_name = iface.MemberDefinition.Name + "." + iface_method.Name;
else
proxy_name = ns + "." + iface.MemberDefinition.Name + "." + iface_method.Name;
var param = iface_method.Parameters;
MethodBuilder proxy = container.TypeBuilder.DefineMethod (
proxy_name,
MethodAttributes.Private |
MethodAttributes.HideBySig |
MethodAttributes.NewSlot |
MethodAttributes.CheckAccessOnOverride |
MethodAttributes.Virtual | MethodAttributes.Final,
CallingConventions.Standard | CallingConventions.HasThis,
base_method.ReturnType.GetMetaInfo (), param.GetMetaInfo ());
if (iface_method.IsGeneric) {
var gnames = iface_method.GenericDefinition.TypeParameters.Select (l => l.Name).ToArray ();
proxy.DefineGenericParameters (gnames);
}
for (int i = 0; i < param.Count; i++) {
string name = param.FixedParameters [i].Name;
ParameterAttributes attr = ParametersCompiled.GetParameterAttribute (param.FixedParameters [i].ModFlags);
proxy.DefineParameter (i + 1, attr, name);
}
int top = param.Count;
var ec = new EmitContext (new ProxyMethodContext (container), proxy.GetILGenerator (), null);
ec.EmitThis ();
// TODO: GetAllParametersArguments
for (int i = 0; i < top; i++)
ec.EmitArgumentLoad (i);
ec.Emit (OpCodes.Call, base_method);
ec.Emit (OpCodes.Ret);
container.TypeBuilder.DefineMethodOverride (proxy, (MethodInfo) iface_method.GetMetaInfo ());
}
示例3: Emit
public void Emit (EmitContext ec)
{
ec.EmitArgumentLoad (idx);
}