本文整理汇总了C#中EmitContext.EmitCall方法的典型用法代码示例。如果您正苦于以下问题:C# EmitContext.EmitCall方法的具体用法?C# EmitContext.EmitCall怎么用?C# EmitContext.EmitCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmitContext
的用法示例。
在下文中一共展示了EmitContext.EmitCall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitPropertyAccess
void EmitPropertyAccess (EmitContext ec, PropertyInfo property)
{
var getter = property.GetGetMethod (true);
if (!getter.IsStatic)
ec.EmitLoadSubject (expression);
ec.EmitCall (getter);
}
示例2: EmitPropertyAccess
private void EmitPropertyAccess(EmitContext emitContext, PropertyInfo property)
{
var getter = property.GetGetMethod(true);
if (!getter.IsStatic)
{
emitContext.EmitLoadSubject(_expression);
}
emitContext.EmitCall(getter);
}
示例3: EmitPropertyAssignment
void EmitPropertyAssignment (EmitContext ec, PropertyInfo property, LocalBuilder local)
{
var setter = property.GetSetMethod (true);
if (setter == null)
throw new InvalidOperationException ();
ec.EmitLoadSubject (local);
expression.Emit (ec);
ec.EmitCall (setter);
}
示例4: EmitLoadProperty
LocalBuilder EmitLoadProperty (EmitContext ec, PropertyInfo property)
{
var getter = property.GetGetMethod (true);
if (getter == null)
throw new NotSupportedException ();
var store = ec.ig.DeclareLocal (property.PropertyType);
ec.EmitCall (getter);
ec.ig.Emit (OpCodes.Stloc, store);
return store;
}
示例5: EmitUserDefinedLiftedLogicalShortCircuit
void EmitUserDefinedLiftedLogicalShortCircuit (EmitContext ec)
{
var ig = ec.ig;
var and = NodeType == ExpressionType.AndAlso;
var left_is_null = ig.DefineLabel ();
var ret_left = ig.DefineLabel ();
var ret_null = ig.DefineLabel ();
var done = ig.DefineLabel ();
var left = ec.EmitStored (this.left);
ec.EmitNullableHasValue (left);
ig.Emit (OpCodes.Brfalse, and ? ret_null : left_is_null);
ec.EmitNullableGetValueOrDefault (left);
ec.EmitCall (and ? GetFalseOperator () : GetTrueOperator ());
ig.Emit (OpCodes.Brtrue, ret_left);
ig.MarkLabel (left_is_null);
var right = ec.EmitStored (this.right);
ec.EmitNullableHasValue (right);
ig.Emit (OpCodes.Brfalse, ret_null);
ec.EmitNullableGetValueOrDefault (left);
ec.EmitNullableGetValueOrDefault (right);
ec.EmitCall (method);
ec.EmitNullableNew (Type);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (ret_left);
ec.EmitLoad (left);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (ret_null);
var ret = ig.DeclareLocal (Type);
ec.EmitNullableInitialize (ret);
ig.MarkLabel (done);
}
示例6: EmitLiftedToNullUserDefinedOperator
void EmitLiftedToNullUserDefinedOperator (EmitContext ec)
{
var ig = ec.ig;
var ret = ig.DefineLabel ();
var done = ig.DefineLabel ();
var left = ec.EmitStored (this.left);
var right = ec.EmitStored (this.right);
ec.EmitNullableHasValue (left);
ec.EmitNullableHasValue (right);
ig.Emit (OpCodes.And);
ig.Emit (OpCodes.Brfalse, ret);
ec.EmitNullableGetValueOrDefault (left);
ec.EmitNullableGetValueOrDefault (right);
ec.EmitCall (method);
ec.EmitNullableNew (Type);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (ret);
var temp = ig.DeclareLocal (Type);
ec.EmitNullableInitialize (temp);
ig.MarkLabel (done);
}
示例7: EmitLiftedUserDefinedOperator
void EmitLiftedUserDefinedOperator (EmitContext ec)
{
var ig = ec.ig;
var ret_true = ig.DefineLabel ();
var ret_false = ig.DefineLabel ();
var done = ig.DefineLabel ();
var left = ec.EmitStored (this.left);
var right = ec.EmitStored (this.right);
ec.EmitNullableHasValue (left);
ec.EmitNullableHasValue (right);
switch (NodeType) {
case ExpressionType.Equal:
ig.Emit (OpCodes.Bne_Un, ret_false);
ec.EmitNullableHasValue (left);
ig.Emit (OpCodes.Brfalse, ret_true);
break;
case ExpressionType.NotEqual:
ig.Emit (OpCodes.Bne_Un, ret_true);
ec.EmitNullableHasValue (left);
ig.Emit (OpCodes.Brfalse, ret_false);
break;
default:
ig.Emit (OpCodes.And);
ig.Emit (OpCodes.Brfalse, ret_false);
break;
}
ec.EmitNullableGetValueOrDefault (left);
ec.EmitNullableGetValueOrDefault (right);
ec.EmitCall (method);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (ret_true);
ig.Emit (OpCodes.Ldc_I4_1);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (ret_false);
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (done);
}
示例8: EmitUserDefinedLogicalShortCircuit
void EmitUserDefinedLogicalShortCircuit (EmitContext ec)
{
var ig = ec.ig;
var and = NodeType == ExpressionType.AndAlso;
var done = ig.DefineLabel ();
var left = ec.EmitStored (this.left);
ec.EmitLoad (left);
ig.Emit (OpCodes.Dup);
ec.EmitCall (and ? GetFalseOperator () : GetTrueOperator ());
ig.Emit (OpCodes.Brtrue, done);
ec.Emit (this.right);
ec.EmitCall (method);
ig.MarkLabel (done);
}
示例9: Emit
internal override void Emit (EmitContext ec)
{
ec.EmitCall (obj, arguments, method);
}
示例10: Emit
internal void Emit(EmitContext emitContext, LocalBuilder local)
{
emitContext.EmitCall(local, _arguments, _addMethod);
EmitPopIfNeeded(emitContext);
}
示例11: EmitUserDefinedOperator
void EmitUserDefinedOperator (EmitContext ec)
{
if (!IsLifted) {
ec.Emit (operand);
ec.EmitCall (method);
} else if (IsLiftedToNull) {
EmitUserDefinedLiftedToNullOperator (ec);
} else
EmitUserDefinedLiftedOperator (ec);
}
示例12: EmitUserDefinedLiftedOperator
void EmitUserDefinedLiftedOperator (EmitContext ec)
{
var local = ec.EmitStored (operand);
ec.EmitNullableGetValue (local);
ec.EmitCall (method);
}
示例13: EmitConvertFromNullable
void EmitConvertFromNullable (EmitContext ec)
{
if (IsBoxing ()) {
ec.Emit (operand);
EmitBox (ec);
return;
}
ec.EmitCall (operand, operand.Type.GetMethod ("get_Value"));
if (operand.Type.GetNotNullableType () != Type) {
EmitPrimitiveConversion (ec,
operand.Type.GetNotNullableType (),
Type);
}
}
示例14: Emit
internal override void Emit (EmitContext ec)
{
ec.EmitCall (expression, arguments, expression.Type.GetInvokeMethod ());
}
示例15: Emit
internal override void Emit(EmitContext emitContext)
{
emitContext.EmitCall(_obj, _arguments, _method);
}