本文整理汇总了C#中EmitContext类的典型用法代码示例。如果您正苦于以下问题:C# EmitContext类的具体用法?C# EmitContext怎么用?C# EmitContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmitContext类属于命名空间,在下文中一共展示了EmitContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitPopIfNeeded
private void EmitPopIfNeeded(EmitContext emitContext)
{
if (GetReturnType() == typeof(void) && body.Type != typeof(void))
{
emitContext.ig.Emit(OpCodes.Pop);
}
}
示例2: EmitPopIfNeeded
void EmitPopIfNeeded (EmitContext ec)
{
if (add_method.ReturnType == typeof (void))
return;
ec.ig.Emit (OpCodes.Pop);
}
示例3: Emit
internal override void Emit (EmitContext ec)
{
ec.EmitIsInst (expression, type_operand);
ec.ig.Emit (OpCodes.Ldnull);
ec.ig.Emit (OpCodes.Cgt_Un);
}
示例4: EmitLoadField
LocalBuilder EmitLoadField (EmitContext ec, FieldInfo field)
{
var store = ec.ig.DeclareLocal (field.FieldType);
ec.ig.Emit (OpCodes.Ldfld, field);
ec.ig.Emit (OpCodes.Stloc, store);
return store;
}
示例5: Emit
internal override void Emit (EmitContext ec)
{
var ig = ec.ig;
var type = this.Type;
LocalBuilder local = null;
if (type.IsValueType) {
local = ig.DeclareLocal (type);
ig.Emit (OpCodes.Ldloca, local);
if (constructor == null) {
ig.Emit (OpCodes.Initobj, type);
ig.Emit (OpCodes.Ldloc, local);
return;
}
}
ec.EmitCollection (arguments);
if (type.IsValueType) {
ig.Emit (OpCodes.Call, constructor);
ig.Emit (OpCodes.Ldloc, local);
} else
ig.Emit (OpCodes.Newobj, constructor ?? GetDefaultConstructor (type));
}
示例6: Emit
internal override void Emit (EmitContext ec, LocalBuilder local)
{
var member = EmitLoadMember (ec, local);
foreach (var initializer in initializers)
initializer.Emit (ec, member);
}
示例7: Emit
internal override void Emit (EmitContext ec, LocalBuilder local)
{
var member = EmitLoadMember (ec, local);
foreach (var binding in bindings)
binding.Emit (ec, member);
}
示例8: EmitPropertyAccess
void EmitPropertyAccess (EmitContext ec, PropertyInfo property)
{
var getter = property.GetGetMethod (true);
if (!getter.IsStatic)
ec.EmitLoadSubject (expression);
ec.EmitCall (getter);
}
示例9: EmitFieldAccess
void EmitFieldAccess (EmitContext ec, FieldInfo field)
{
if (!field.IsStatic) {
ec.EmitLoadSubject (expression);
ec.ig.Emit (OpCodes.Ldfld, field);
} else
ec.ig.Emit (OpCodes.Ldsfld, field);
}
示例10: EmitLoadMember
internal LocalBuilder EmitLoadMember (EmitContext ec, LocalBuilder local)
{
ec.EmitLoadSubject (local);
return member.OnFieldOrProperty<LocalBuilder> (
field => EmitLoadField (ec, field),
prop => EmitLoadProperty (ec, prop));
}
示例11: Emit
internal override void Emit(EmitContext emitContext)
{
_member.OnFieldOrProperty
(
field => EmitFieldAccess(emitContext, field),
prop => EmitPropertyAccess(emitContext, prop)
);
}
示例12: EmitPopIfNeeded
private void EmitPopIfNeeded(EmitContext emitContext)
{
if (_addMethod.ReturnType == typeof(void))
{
return;
}
emitContext.ig.Emit(OpCodes.Pop);
}
示例13: EmitLoadMember
internal LocalBuilder EmitLoadMember(EmitContext emitContext, LocalBuilder local)
{
emitContext.EmitLoadSubject(local);
return _member.OnFieldOrProperty
(
field => EmitLoadField(emitContext, field),
prop => EmitLoadProperty(emitContext, prop)
);
}
示例14: EmitPropertyAccess
private void EmitPropertyAccess(EmitContext emitContext, PropertyInfo property)
{
var getter = property.GetGetMethod(true);
if (!getter.IsStatic)
{
emitContext.EmitLoadSubject(_expression);
}
emitContext.EmitCall(getter);
}
示例15: EmitTypeAs
void EmitTypeAs (EmitContext ec)
{
var type = this.Type;
ec.EmitIsInst (operand, type);
if (type.IsNullable ())
ec.ig.Emit (OpCodes.Unbox_Any, type);
}