本文整理汇总了C#中EmitContext.EmitLoad方法的典型用法代码示例。如果您正苦于以下问题:C# EmitContext.EmitLoad方法的具体用法?C# EmitContext.EmitLoad怎么用?C# EmitContext.EmitLoad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmitContext
的用法示例。
在下文中一共展示了EmitContext.EmitLoad方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitConvertedCoalesce
void EmitConvertedCoalesce (EmitContext ec)
{
var ig = ec.ig;
var done = ig.DefineLabel ();
var load_right = ig.DefineLabel ();
var left = ec.EmitStored (this.left);
if (left.LocalType.IsNullable ())
ec.EmitNullableHasValue (left);
else
ec.EmitLoad (left);
ig.Emit (OpCodes.Brfalse, load_right);
ec.Emit (conversion);
ec.EmitLoad (left);
ig.Emit (OpCodes.Callvirt, conversion.Type.GetInvokeMethod ());
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (load_right);
ec.Emit (this.right);
ig.MarkLabel (done);
}
示例2: 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);
}
示例3: 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);
}
示例4: EmitCoalesce
void EmitCoalesce (EmitContext ec)
{
var ig = ec.ig;
var done = ig.DefineLabel ();
var load_right = ig.DefineLabel ();
var left = ec.EmitStored (this.left);
var left_is_nullable = left.LocalType.IsNullable ();
if (left_is_nullable)
ec.EmitNullableHasValue (left);
else
ec.EmitLoad (left);
ig.Emit (OpCodes.Brfalse, load_right);
if (left_is_nullable && !Type.IsNullable ())
ec.EmitNullableGetValue (left);
else
ec.EmitLoad (left);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (load_right);
ec.Emit (this.right);
ig.MarkLabel (done);
}
示例5: EmitLiftedLogical
void EmitLiftedLogical (EmitContext ec)
{
var ig = ec.ig;
var and = NodeType == ExpressionType.And;
var left = ec.EmitStored (this.left);
var right = ec.EmitStored (this.right);
var ret_from_left = ig.DefineLabel ();
var ret_from_right = ig.DefineLabel ();
var done = ig.DefineLabel ();
ec.EmitNullableGetValueOrDefault (left);
ig.Emit (OpCodes.Brtrue, ret_from_left);
ec.EmitNullableGetValueOrDefault (right);
ig.Emit (OpCodes.Brtrue, ret_from_right);
ec.EmitNullableHasValue (left);
ig.Emit (OpCodes.Brfalse, ret_from_left);
ig.MarkLabel (ret_from_right);
ec.EmitLoad (and ? left : right);
ig.Emit (OpCodes.Br, done);
ig.MarkLabel (ret_from_left);
ec.EmitLoad (and ? right : left);
ig.MarkLabel (done);
}
示例6: Emit
internal override void Emit (EmitContext ec)
{
var local = ec.EmitStored (new_expression);
ec.EmitCollection (initializers, local);
ec.EmitLoad (local);
}
示例7: Emit
internal override void Emit(EmitContext emitContext)
{
var local = emitContext.EmitStored(_newExpression);
emitContext.EmitCollection(_initializers, local);
emitContext.EmitLoad(local);
}
示例8: EmitConvertedCoalesce
private void EmitConvertedCoalesce(EmitContext emitContext)
{
var ig = emitContext.ig;
var done = ig.DefineLabel();
var load_right = ig.DefineLabel();
var left = emitContext.EmitStored(_left);
if (left.LocalType.IsNullable())
{
emitContext.EmitNullableHasValue(left);
}
else
{
emitContext.EmitLoad(left);
}
ig.Emit(OpCodes.Brfalse, load_right);
emitContext.Emit(_conversion);
emitContext.EmitLoad(left);
ig.Emit(OpCodes.Callvirt, _conversion.Type.GetInvokeMethod());
ig.Emit(OpCodes.Br, done);
ig.MarkLabel(load_right);
emitContext.Emit(_right);
ig.MarkLabel(done);
}
示例9: EmitCoalesce
private void EmitCoalesce(EmitContext emitContext)
{
var ig = emitContext.ig;
var done = ig.DefineLabel();
var load_right = ig.DefineLabel();
var left = emitContext.EmitStored(_left);
var left_is_nullable = left.LocalType.IsNullable();
if (left_is_nullable)
{
emitContext.EmitNullableHasValue(left);
}
else
{
emitContext.EmitLoad(left);
}
ig.Emit(OpCodes.Brfalse, load_right);
if (left_is_nullable && !Type.IsNullable())
{
emitContext.EmitNullableGetValue(left);
}
else
{
emitContext.EmitLoad(left);
}
ig.Emit(OpCodes.Br, done);
ig.MarkLabel(load_right);
emitContext.Emit(_right);
ig.MarkLabel(done);
}