当前位置: 首页>>代码示例>>C#>>正文


C# EmitContext.EmitStored方法代码示例

本文整理汇总了C#中EmitContext.EmitStored方法的典型用法代码示例。如果您正苦于以下问题:C# EmitContext.EmitStored方法的具体用法?C# EmitContext.EmitStored怎么用?C# EmitContext.EmitStored使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EmitContext的用法示例。


在下文中一共展示了EmitContext.EmitStored方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:45,代码来源:BinaryExpression.cs

示例2: EmitLiftedToNullBinary

		void EmitLiftedToNullBinary (EmitContext ec)
		{
			var ig = ec.ig;
			var left = ec.EmitStored (this.left);
			var right = ec.EmitStored (this.right);
			var result = ig.DeclareLocal (Type);

			var has_value = ig.DefineLabel ();
			var done = ig.DefineLabel ();

			ec.EmitNullableHasValue (left);
			ec.EmitNullableHasValue (right);
			ig.Emit (OpCodes.And);
			ig.Emit (OpCodes.Brtrue, has_value);

			ec.EmitNullableInitialize (result);

			ig.Emit (OpCodes.Br, done);

			ig.MarkLabel (has_value);

			ec.EmitNullableGetValueOrDefault (left);
			ec.EmitNullableGetValueOrDefault (right);

			EmitBinaryOperator (ec);

			ec.EmitNullableNew (result.LocalType);

			ig.MarkLabel (done);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:30,代码来源:BinaryExpression.cs

示例3: EmitLiftedRelationalBinary

		void EmitLiftedRelationalBinary (EmitContext ec)
		{
			var ig = ec.ig;
			var left = ec.EmitStored (this.left);
			var right = ec.EmitStored (this.right);

			var ret = ig.DefineLabel ();
			var done = ig.DefineLabel ();

			ec.EmitNullableGetValueOrDefault (left);
			ec.EmitNullableGetValueOrDefault (right);

			switch (NodeType) {
			case ExpressionType.Equal:
			case ExpressionType.NotEqual:
				ig.Emit (OpCodes.Bne_Un, ret);
				break;
			default:
				EmitBinaryOperator (ec);
				ig.Emit (OpCodes.Brfalse, ret);
				break;
			}

			ec.EmitNullableHasValue (left);
			ec.EmitNullableHasValue (right);

			switch (NodeType) {
			case ExpressionType.Equal:
				ig.Emit (OpCodes.Ceq);
				break;
			case ExpressionType.NotEqual:
				ig.Emit (OpCodes.Ceq);
				ig.Emit (OpCodes.Ldc_I4_0);
				ig.Emit (OpCodes.Ceq);
				break;
			default:
				ig.Emit (OpCodes.And);
				break;
			}

			ig.Emit (OpCodes.Br, done);

			ig.MarkLabel (ret);

			ig.Emit (NodeType == ExpressionType.NotEqual ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);

			ig.MarkLabel (done);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:48,代码来源:BinaryExpression.cs

示例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);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:28,代码来源:BinaryExpression.cs

示例5: 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);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:26,代码来源:BinaryExpression.cs

示例6: 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);
 }
开发者ID:qwertie,项目名称:Theraot,代码行数:23,代码来源:BinaryExpression.net30.cs

示例7: EmitLiftedLogicalShortCircuit

		void EmitLiftedLogicalShortCircuit (EmitContext ec)
		{
			var ig = ec.ig;
			var and = NodeType == ExpressionType.AndAlso;
			var left_is_null = ig.DefineLabel ();
			var ret_from_left = ig.DefineLabel ();
			var ret_null = ig.DefineLabel ();
			var ret_new = ig.DefineLabel();
			var done = ig.DefineLabel();

			var left = ec.EmitStored (this.left);

			ec.EmitNullableHasValue (left);
			ig.Emit (OpCodes.Brfalse, left_is_null);

			ec.EmitNullableGetValueOrDefault (left);

			ig.Emit (OpCodes.Ldc_I4_0);
			ig.Emit (OpCodes.Ceq);
			ig.Emit (and ? OpCodes.Brtrue : OpCodes.Brfalse, ret_from_left);

			ig.MarkLabel (left_is_null);
			var right = ec.EmitStored (this.right);

			ec.EmitNullableHasValue (right);
			ig.Emit (OpCodes.Brfalse_S, ret_null);

			ec.EmitNullableGetValueOrDefault (right);

			ig.Emit (OpCodes.Ldc_I4_0);
			ig.Emit (OpCodes.Ceq);

			ig.Emit (and ? OpCodes.Brtrue : OpCodes.Brfalse, ret_from_left);

			ec.EmitNullableHasValue (left);
			ig.Emit (OpCodes.Brfalse, ret_null);

			ig.Emit (and ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
			ig.Emit (OpCodes.Br_S, ret_new);

			ig.MarkLabel (ret_from_left);
			ig.Emit (and ? OpCodes.Ldc_I4_0 : OpCodes.Ldc_I4_1);

			ig.MarkLabel (ret_new);
			ec.EmitNullableNew (Type);
			ig.Emit (OpCodes.Br, done);

			ig.MarkLabel (ret_null);
			var ret = ig.DeclareLocal (Type);
			ec.EmitNullableInitialize (ret);

			ig.MarkLabel (done);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:53,代码来源:BinaryExpression.cs

示例8: EmitNullEquality

		void EmitNullEquality (EmitContext ec, Expression e)
		{
			var ig = ec.ig;

			if (IsLiftedToNull) {
				e.Emit (ec);
				if (e.Type != typeof (void))
					ig.Emit (OpCodes.Pop);

				ec.EmitNullableNew (typeof (bool?));
				return;
			}

			var se = ec.EmitStored (e);
			ec.EmitNullableHasValue (se);
			if (NodeType == ExpressionType.Equal) {
				ig.Emit (OpCodes.Ldc_I4_0);
				ig.Emit (OpCodes.Ceq);
			}		
		}
开发者ID:nlhepler,项目名称:mono,代码行数:20,代码来源:BinaryExpression.cs

示例9: 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);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:28,代码来源:BinaryExpression.cs

示例10: EmitLiftedUnary

		void EmitLiftedUnary (EmitContext ec)
		{
			var ig = ec.ig;

			var from = ec.EmitStored (operand);
			var to = ig.DeclareLocal (Type);

			var has_value = ig.DefineLabel ();
			var done = ig.DefineLabel ();

			ec.EmitNullableHasValue (from);
			ig.Emit (OpCodes.Brtrue, has_value);

			// if not has value
			ec.EmitNullableInitialize (to);

			ig.Emit (OpCodes.Br, done);

			ig.MarkLabel (has_value);
			// if has value
			ec.EmitNullableGetValueOrDefault (from);

			EmitUnaryOperator (ec);

			ec.EmitNullableNew (Type);

			ig.MarkLabel (done);
		}
开发者ID:qwertie,项目名称:Theraot,代码行数:28,代码来源:UnaryExpression.net30.cs

示例11: Emit

		internal override void Emit (EmitContext ec)
		{
			var local = ec.EmitStored (new_expression);
			ec.EmitCollection (initializers, local);
			ec.EmitLoad (local);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:6,代码来源:ListInitExpression.cs

示例12: EmitUserDefinedLiftedOperator

		void EmitUserDefinedLiftedOperator (EmitContext ec)
		{
			var local = ec.EmitStored (operand);
			ec.EmitNullableGetValue (local);
			ec.EmitCall (method);
		}
开发者ID:qwertie,项目名称:Theraot,代码行数:6,代码来源:UnaryExpression.net30.cs

示例13: Emit

 internal override void Emit(EmitContext emitContext)
 {
     var local = emitContext.EmitStored(_newExpression);
     emitContext.EmitCollection(_initializers, local);
     emitContext.EmitLoad(local);
 }
开发者ID:qwertie,项目名称:Theraot,代码行数:6,代码来源:ListInitExpression.net30.cs

示例14: EmitLeftLiftedToNullBinary

 private void EmitLeftLiftedToNullBinary(EmitContext emitContext)
 {
     var ig = emitContext.ig;
     var ret = ig.DefineLabel();
     var done = ig.DefineLabel();
     var left = emitContext.EmitStored(_left);
     emitContext.EmitNullableHasValue(left);
     ig.Emit(OpCodes.Brfalse, ret);
     emitContext.EmitNullableGetValueOrDefault(left);
     emitContext.Emit(_right);
     EmitBinaryOperator(emitContext);
     emitContext.EmitNullableNew(Type);
     ig.Emit(OpCodes.Br, done);
     ig.MarkLabel(ret);
     var temp = ig.DeclareLocal(Type);
     emitContext.EmitNullableInitialize(temp);
     ig.MarkLabel(done);
 }
开发者ID:qwertie,项目名称:Theraot,代码行数:18,代码来源:BinaryExpression.net30.cs

示例15: 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);
		}
开发者ID:jskripsky,项目名称:mono,代码行数:27,代码来源:BinaryExpression.cs


注:本文中的EmitContext.EmitStored方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。