本文整理汇总了C#中IMemberEmitter类的典型用法代码示例。如果您正苦于以下问题:C# IMemberEmitter类的具体用法?C# IMemberEmitter怎么用?C# IMemberEmitter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMemberEmitter类属于命名空间,在下文中一共展示了IMemberEmitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
foreach (Statement s in statements)
{
s.Emit(member, gen);
}
}
示例2: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
ArgumentsUtil.EmitLoadOwnerAndReference(reference, gen);
var notNull = gen.DefineLabel();
gen.Emit(OpCodes.Brtrue_S, notNull);
ifNull.Emit(member, gen);
gen.MarkLabel(notNull);
ifNotNull.Emit(member, gen);
}
示例3: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
right.Emit(member, gen);
if (fromType == target)
{
return;
}
if (fromType.IsByRef)
{
fromType = fromType.GetElementType();
}
if (target.IsByRef)
{
target = target.GetElementType();
}
if (target.IsArray())
{
if (fromType.IsValueType())
{
throw new NotImplementedException("Cannot convert between distinct value types");
}
else
{
// Unbox conversion
// Assumes fromType is a boxed value
// if we can, we emit a box and ldind, otherwise, we will use unbox.any
if (LdindOpCodesDictionary.Instance[target] != LdindOpCodesDictionary.EmptyOpCode)
{
gen.Emit(OpCodes.Unbox, target);
OpCodeUtil.EmitLoadIndirectOpCodeForType(gen, target);
}
else
{
gen.Emit(OpCodes.Unbox_Any, target);
}
}
}
else
{
if (fromType.IsValueType())
{
// Box conversion
gen.Emit(OpCodes.Box, fromType);
EmitCastIfNeeded(typeof(object), target, gen);
}
else
{
// Possible down-cast
EmitCastIfNeeded(fromType, target, gen);
}
}
}
示例4: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
expression.Emit(member, gen);
gen.Emit(OpCodes.Dup);
var label = gen.DefineLabel();
gen.Emit(OpCodes.Brtrue_S, label);
gen.Emit(OpCodes.Pop);
@default.Emit(member, gen);
gen.MarkLabel(label);
}
示例5: Emit
public override void Emit(IMemberEmitter member, ILGenerator il)
{
ArgumentsUtil.EmitLoadOwnerAndReference(targetArray, il);
il.Emit(OpCodes.Ldc_I4, targetPosition);
value.Emit(member, il);
il.Emit(OpCodes.Stelem_Ref);
}
示例6: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
var ci = exceptionType.GetConstructor(new[] { typeof(String) });
var constRef = new ConstReference(errorMessage);
var creationStmt = new NewInstanceExpression(ci, constRef.ToExpression());
creationStmt.Emit(member, gen);
gen.Emit(OpCodes.Throw);
}
示例7: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
gen.Emit(OpCodes.Ldarg_0);
foreach (var exp in args)
{
exp.Emit(member, gen);
}
gen.Emit(OpCodes.Call, cmethod);
}
示例8: Generate
internal void Generate(IMemberEmitter member, ILGenerator il)
{
foreach (Reference local in ilmarkers)
{
local.Generate(il);
}
foreach (Statement stmt in stmts)
{
stmt.Emit(member, il);
}
}
示例9: Generate
internal void Generate(IMemberEmitter member, ILGenerator il)
{
foreach (var local in ilmarkers)
{
local.Generate(il);
}
foreach (var stmt in stmts)
{
stmt.Emit(member, il);
}
}
示例10: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
gen.Emit(OpCodes.Ldtoken, method);
if (declaringType == null)
{
throw new GeneratorException("declaringType can't be null for this situation");
}
gen.Emit(OpCodes.Ldtoken, declaringType);
var minfo = MethodBaseMethods.GetMethodFromHandle2;
gen.Emit(OpCodes.Call, minfo);
gen.Emit(OpCodes.Castclass, typeof(MethodInfo));
}
示例11: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
owner.Emit(member, gen);
gen.Emit(OpCodes.Dup);
if (methodToBindTo.IsFinal)
{
gen.Emit(OpCodes.Ldftn, methodToBindTo);
}
else
{
gen.Emit(OpCodes.Ldvirtftn, methodToBindTo);
}
gen.Emit(OpCodes.Newobj, delegateCtor);
}
示例12: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
right.Emit(member, gen);
if (fromType == target)
{
return;
}
if (fromType.IsByRef)
{
fromType = fromType.GetElementType();
}
if (target.IsByRef)
{
target = target.GetElementType();
}
if (target.IsValueType)
{
if (fromType.IsValueType)
{
throw new NotImplementedException("Cannot convert between distinct value types");
}
else
{
// Unbox conversion
// Assumes fromType is a boxed value
gen.Emit(OpCodes.Unbox, target);
OpCodeUtil.EmitLoadIndirectOpCodeForType(gen, target);
}
}
else
{
if (fromType.IsValueType)
{
// Box conversion
gen.Emit(OpCodes.Box, fromType);
EmitCastIfNeeded(typeof(object), target, gen);
}
else
{
// Possible down-cast
EmitCastIfNeeded(fromType, target, gen);
}
}
}
示例13: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
ArgumentsUtil.EmitLoadOwnerAndReference(owner, gen);
foreach (var exp in args)
{
exp.Emit(member, gen);
}
if (VirtualCall)
{
gen.Emit(OpCodes.Callvirt, method);
}
else
{
gen.Emit(OpCodes.Call, method);
}
}
示例14: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
foreach (Expression exp in arguments)
{
exp.Emit(member, gen);
}
if (constructor == null)
{
constructor = type.GetConstructor(constructor_args);
}
if (constructor == null)
{
throw new ProxyGenerationException("Could not find constructor matching specified arguments");
}
gen.Emit(OpCodes.Newobj, constructor);
}
示例15: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
gen.Emit(OpCodes.Ldtoken, method);
#if !MONO
if (declaringType == null)
{
throw new GeneratorException("declaringType can't be null for this situation");
}
gen.Emit(OpCodes.Ldtoken, declaringType);
#endif
MethodInfo minfo = Constants.GetMethodFromHandle1;
#if !MONO
minfo = Constants.GetMethodFromHandle2;
#endif
gen.Emit(OpCodes.Call, minfo);
gen.Emit(OpCodes.Castclass, typeof(MethodInfo));
}