本文整理汇总了C#中IMemberEmitter类的典型用法代码示例。如果您正苦于以下问题:C# IMemberEmitter类的具体用法?C# IMemberEmitter怎么用?C# IMemberEmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMemberEmitter类属于命名空间,在下文中一共展示了IMemberEmitter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
foreach (Statement s in statements)
{
s.Emit(member, gen);
}
}
开发者ID:jeremymeng,项目名称:Core,代码行数:7,代码来源:MultiStatementExpression.cs
示例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);
}
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:9,代码来源:IfNullExpression.cs
示例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);
}
}
}
开发者ID:rajgit31,项目名称:MetroUnitTestsDemoApp,代码行数:56,代码来源:ConvertExpression.cs
示例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);
}
开发者ID:brianmatic,项目名称:n2cms,代码行数:10,代码来源:NullCoalescingOperatorExpression.cs
示例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);
}
开发者ID:ralescano,项目名称:castle,代码行数:10,代码来源:AssignArrayStatement.cs
示例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);
}
开发者ID:rajgit31,项目名称:MetroUnitTestsDemoApp,代码行数:11,代码来源:ThrowStatement.cs
示例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);
}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:11,代码来源:ConstructorInvocationStatement.cs
示例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);
}
}
开发者ID:ralescano,项目名称:castle,代码行数:12,代码来源:AbstractCodeBuilder.cs
示例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);
}
}
开发者ID:BiBongNet,项目名称:JustMockLite,代码行数:12,代码来源:AbstractCodeBuilder.cs
示例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));
}
开发者ID:elevine,项目名称:Core,代码行数:13,代码来源:MethodTokenExpression.cs
示例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);
}
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:14,代码来源:BindDelegateExpression.cs
示例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);
}
}
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:48,代码来源:ConvertExpression.cs
示例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);
}
}
开发者ID:leloulight,项目名称:Core,代码行数:18,代码来源:MethodInvocationExpression.cs
示例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);
}
开发者ID:ralescano,项目名称:castle,代码行数:19,代码来源:NewInstanceExpression.cs
示例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));
}
开发者ID:pallmall,项目名称:WCell,代码行数:20,代码来源:MethodTokenExpression.cs
示例16: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
if (reference != null)
{
ArgumentsUtil.EmitLoadOwnerAndReference(reference, gen);
}
else if (expression != null)
{
expression.Emit(member, gen);
}
else
{
if (member.ReturnType != typeof(void))
{
OpCodeUtil.EmitLoadOpCodeForDefaultValueOfType(gen, member.ReturnType);
}
}
gen.Emit(OpCodes.Ret);
}
开发者ID:brianmatic,项目名称:n2cms,代码行数:20,代码来源:ReturnStatement.cs
示例17: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
var local = gen.DeclareLocal(typeof(object[]));
gen.Emit(OpCodes.Ldc_I4, args.Length);
gen.Emit(OpCodes.Newarr, typeof(object));
gen.Emit(OpCodes.Stloc, local);
for (var i = 0; i < args.Length; i++)
{
gen.Emit(OpCodes.Ldloc, local);
gen.Emit(OpCodes.Ldc_I4, i);
var reference = args[i];
ArgumentsUtil.EmitLoadOwnerAndReference(reference, gen);
if (reference.Type.IsByRef)
{
throw new NotSupportedException();
}
if (reference.Type.IsPointer)
{
gen.Emit(OpCodes.Call, ArgumentsUtil.IntPtrFromPointer());
gen.Emit(OpCodes.Box, typeof(IntPtr));
}
else if (reference.Type.IsValueType)
{
gen.Emit(OpCodes.Box, reference.Type.UnderlyingSystemType);
}
else if (reference.Type.IsGenericParameter)
{
gen.Emit(OpCodes.Box, reference.Type);
}
gen.Emit(OpCodes.Stelem_Ref);
}
gen.Emit(OpCodes.Ldloc, local);
}
开发者ID:ArthurYiL,项目名称:JustMockLite,代码行数:40,代码来源:ReferencesToObjectArrayExpression.cs
示例18: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
switch (value)
{
case -1:
gen.Emit(OpCodes.Ldc_I4_M1);
break;
case 0:
gen.Emit(OpCodes.Ldc_I4_0);
break;
case 1:
gen.Emit(OpCodes.Ldc_I4_1);
break;
case 2:
gen.Emit(OpCodes.Ldc_I4_2);
break;
case 3:
gen.Emit(OpCodes.Ldc_I4_3);
break;
case 4:
gen.Emit(OpCodes.Ldc_I4_4);
break;
case 5:
gen.Emit(OpCodes.Ldc_I4_5);
break;
case 6:
gen.Emit(OpCodes.Ldc_I4_6);
break;
case 7:
gen.Emit(OpCodes.Ldc_I4_7);
break;
case 8:
gen.Emit(OpCodes.Ldc_I4_8);
break;
default:
gen.Emit(OpCodes.Ldc_I4, value);
break;
}
}
开发者ID:leloulight,项目名称:Core,代码行数:39,代码来源:LiteralIntExpression.cs
示例19: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
// @mbrit - 2012-06-04 - can't do anything other than pass proper MethodInfo
// instances down a this is all MSIL knows how to deal with...
gen.Emit(OpCodes.Ldtoken, method.AsMethodInfo());
#if !MONO
if (declaringType == null)
{
throw new GeneratorException("declaringType can't be null for this situation");
}
gen.Emit(OpCodes.Ldtoken, declaringType);
#endif
var minfo = MethodBaseMethods.GetMethodFromHandle1;
#if !MONO
minfo = MethodBaseMethods.GetMethodFromHandle2;
#endif
gen.Emit(OpCodes.Call, minfo);
gen.Emit(OpCodes.Castclass, typeof(MethodInfo));
}
开发者ID:rajgit31,项目名称:MetroUnitTestsDemoApp,代码行数:22,代码来源:MethodTokenExpression.cs
示例20: Emit
public override void Emit(IMemberEmitter member, ILGenerator gen)
{
// TODO: check if this can be simplified by using more of OpCodeUtil and other existing types
if (IsPrimitiveOrClass(type))
{
OpCodeUtil.EmitLoadOpCodeForDefaultValueOfType(gen, type);
}
else if(type.IsValueType || type.IsGenericParameter)
{
// TODO: handle decimal explicitly
var local = gen.DeclareLocal(type);
gen.Emit(OpCodes.Ldloca_S, local);
gen.Emit(OpCodes.Initobj, type);
gen.Emit(OpCodes.Ldloc, local);
}
else if (type.IsByRef)
{
EmitByRef(gen);
}
else
{
throw new ProxyGenerationException("Can't emit default value for type " + type);
}
}
开发者ID:JulianBirch,项目名称:Castle.Core,代码行数:24,代码来源:DefaultValueExpression.cs
注:本文中的IMemberEmitter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论