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


C# BuilderContext.HasSet方法代码示例

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


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

示例1: MakeExpression

 public override SLE.Expression MakeExpression(BuilderContext ctx)
 {
     return ctx.HasSet (BuilderContext.Options.CheckedScope) ?
         SLE.Expression.ConvertChecked (child.MakeExpression (ctx), type.GetMetaInfo ()) :
         SLE.Expression.Convert (child.MakeExpression (ctx), type.GetMetaInfo ());
 }
开发者ID:speier,项目名称:shake,代码行数:6,代码来源:ecore.cs

示例2: MakeExpression

		public override System.Linq.Expressions.Expression MakeExpression (BuilderContext ctx)
		{
			var tassign = target as IDynamicAssign;
			if (tassign == null)
				throw new InternalErrorException (target.GetType () + " does not support dynamic assignment");

			var target_object = tassign.MakeAssignExpression (ctx, source);

			//
			// Some hacking is needed as DLR does not support void type and requires
			// always have object convertible return type to support caching and chaining
			//
			// We do this by introducing an explicit block which returns RHS value when
			// available or null
			//
			if (target_object.NodeType == System.Linq.Expressions.ExpressionType.Block)
				return target_object;

			System.Linq.Expressions.UnaryExpression source_object;
			if (ctx.HasSet (BuilderContext.Options.CheckedScope)) {
				source_object = System.Linq.Expressions.Expression.ConvertChecked (source.MakeExpression (ctx), target_object.Type);
			} else {
				source_object = System.Linq.Expressions.Expression.Convert (source.MakeExpression (ctx), target_object.Type);
			}

			return System.Linq.Expressions.Expression.Assign (target_object, source_object);
		}
开发者ID:dyxu,项目名称:vimrc,代码行数:27,代码来源:assign.cs

示例3: MakeExpression

		public override SLE.Expression MakeExpression (BuilderContext ctx)
		{
			var le = left.MakeExpression (ctx);
			var re = right.MakeExpression (ctx);
			bool is_checked = ctx.HasSet (BuilderContext.Options.CheckedScope);

			switch (oper) {
			case Operator.Addition:
				return is_checked ? SLE.Expression.AddChecked (le, re) : SLE.Expression.Add (le, re);
			case Operator.BitwiseAnd:
				return SLE.Expression.And (le, re);
			case Operator.BitwiseOr:
				return SLE.Expression.Or (le, re);
			case Operator.Division:
				return SLE.Expression.Divide (le, re);
			case Operator.Equality:
				return SLE.Expression.Equal (le, re);
			case Operator.ExclusiveOr:
				return SLE.Expression.ExclusiveOr (le, re);
			case Operator.GreaterThan:
				return SLE.Expression.GreaterThan (le, re);
			case Operator.GreaterThanOrEqual:
				return SLE.Expression.GreaterThanOrEqual (le, re);
			case Operator.Inequality:
				return SLE.Expression.NotEqual (le, re);
			case Operator.LeftShift:
				return SLE.Expression.LeftShift (le, re);
			case Operator.LessThan:
				return SLE.Expression.LessThan (le, re);
			case Operator.LessThanOrEqual:
				return SLE.Expression.LessThanOrEqual (le, re);
			case Operator.LogicalAnd:
				return SLE.Expression.AndAlso (le, re);
			case Operator.LogicalOr:
				return SLE.Expression.OrElse (le, re);
			case Operator.Modulus:
				return SLE.Expression.Modulo (le, re);
			case Operator.Multiply:
				return is_checked ? SLE.Expression.MultiplyChecked (le, re) : SLE.Expression.Multiply (le, re);
			case Operator.RightShift:
				return SLE.Expression.RightShift (le, re);
			case Operator.Subtraction:
				return is_checked ? SLE.Expression.SubtractChecked (le, re) : SLE.Expression.Subtract (le, re);
			default:
				throw new NotImplementedException (oper.ToString ());
			}
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:47,代码来源:expression.cs


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