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


C# Ast.Expression类代码示例

本文整理汇总了C#中Boo.Lang.Compiler.Ast.Expression的典型用法代码示例。如果您正苦于以下问题:C# Expression类的具体用法?C# Expression怎么用?C# Expression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Expression类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了Expression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsLogicalCondition

 public static bool IsLogicalCondition(Expression node)
 {
     Node condition = node;
     while (IsLogicalExpression(condition.ParentNode))
         condition = condition.ParentNode;
     return IsConditionOfConditionalStatement(condition);
 }
开发者ID:neonux,项目名称:boo,代码行数:7,代码来源:InjectImplicitBooleanConversions.cs

示例2: ComparisonFor

 public static Expression ComparisonFor(Expression local, IEnumerable<Expression> expressions)
 {
     BinaryExpression expression;
     IEnumerator<Expression> enumerator = expressions.GetEnumerator();
     if (!enumerator.MoveNext())
     {
         throw new AssertionFailedException("e.MoveNext()");
     }
     BinaryExpression expression1 = expression = new BinaryExpression(LexicalInfo.Empty);
     expression.set_Operator(11);
     expression.set_Left(Expression.Lift(local));
     expression.set_Right(Expression.Lift(enumerator.Current));
     Expression expression2 = expression;
     while (enumerator.MoveNext())
     {
         BinaryExpression expression3;
         BinaryExpression expression4;
         BinaryExpression expression11 = expression4 = new BinaryExpression(LexicalInfo.Empty);
         expression4.set_Operator(0x1c);
         expression4.set_Left(Expression.Lift(expression2));
         BinaryExpression expression12 = expression3 = new BinaryExpression(LexicalInfo.Empty);
         expression3.set_Operator(11);
         expression3.set_Left(Expression.Lift(local));
         expression3.set_Right(Expression.Lift(enumerator.Current));
         expression4.set_Right(expression3);
         expression2 = expression4;
     }
     return expression2;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:29,代码来源:SwitchMacroModule.cs

示例3: Slice

 public Slice(LexicalInfo lexicalInfo, Expression begin, Expression end, Expression step)
     : base(lexicalInfo)
 {
     this.Begin = begin;
     this.End = end;
     this.Step = step;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:Slice.cs

示例4: ExplicitBooleanContext

        private Expression ExplicitBooleanContext(Expression expression)
        {
            var type = GetExpressionType(expression);
            if (type == TypeSystemServices.BoolType)
            {
            return expression;
            }

            // happening
            //Trace.Assert(!TypeSystemServices.IsError(expression), "shouldn't have error boolean expression.");

            if (TypeSystemServices.IsNumber(type) || type.IsEnum)
            {
            return CodeBuilder.CreateBoundBinaryExpression(
                TypeSystemServices.BoolType,
                BinaryOperatorType.Equality,
                expression,
                CodeBuilder.CreateIntegerLiteral(0));
            }
            else if (TypeSystemServices.IsReferenceType(type))
            {
            return CodeBuilder.CreateBoundBinaryExpression(
                TypeSystemServices.BoolType,
                BinaryOperatorType.Equality,
                expression,
                CodeBuilder.CreateNullLiteral());
            }

            return expression;
        }
开发者ID:jagt,项目名称:us2cs,代码行数:30,代码来源:InjectExplicitBooleanConversion.cs

示例5: BinaryExpression

 public BinaryExpression(LexicalInfo lexicalInfoProvider, BinaryOperatorType operator_, Expression left, Expression right)
     : base(lexicalInfoProvider)
 {
     this.Operator = operator_;
     this.Left = left;
     this.Right = right;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:BinaryExpression.cs

示例6: PropagateChanges

 public override void PropagateChanges(MethodInvocationExpression eval, List chain)
 {
     ExpressionCollection expressions = new ExpressionCollection();
     foreach (object local1 in chain.Reversed)
     {
         if (!(local1 is ProcessAssignmentsToSpecialMembers.ChainItem))
         {
         }
         ProcessAssignmentsToSpecialMembers.ChainItem item = (ProcessAssignmentsToSpecialMembers.ChainItem) RuntimeServices.Coerce(local1, typeof(ProcessAssignmentsToSpecialMembers.ChainItem));
         if (item.Container is MethodInvocationExpression)
         {
             break;
         }
         if (item.Container is SlicingExpression)
         {
             SlicingExpression expression = item.Container;
             Expression[] expressionArray1 = new Expression[] { expression.get_Target().CloneNode(), expression.get_Indices().get_Item(0).get_Begin().CloneNode(), this.get_CodeBuilder().CreateReference(item.Local) };
             expressions.Add(this.CreateConstructorInvocation(this._sliceValueTypeChangeConstructor, expressionArray1));
             break;
         }
         MemberReferenceExpression container = item.Container;
         Expression[] args = new Expression[] { container.get_Target().CloneNode(), this.get_CodeBuilder().CreateStringLiteral(container.get_Name()), this.get_CodeBuilder().CreateReference(item.Local) };
         expressions.Add(this.CreateConstructorInvocation(this._valueTypeChangeConstructor, args));
     }
     MethodInvocationExpression expression3 = this.get_CodeBuilder().CreateMethodInvocation(this._propagateChanges);
     IArrayType type = this._valueTypeChangeType.MakeArrayType(1);
     expression3.get_Arguments().Add(this.get_CodeBuilder().CreateArray(type, expressions));
     eval.get_Arguments().Add(expression3);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:29,代码来源:ProcessAssignmentToDuckMembers.cs

示例7: IfStatement

 public IfStatement(LexicalInfo token, Expression condition, Block trueBlock, Block falseBlock)
     : base(token)
 {
     this.Condition = condition;
     this.TrueBlock = trueBlock;
     this.FalseBlock = falseBlock;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:IfStatement.cs

示例8: Reify

 public Expression Reify(Expression node)
 {
     if (ShouldReify())
     {
         RunExpansionIterations();
     }
     return node;
 }
开发者ID:boo-lang,项目名称:boo,代码行数:8,代码来源:MacroAndAttributeExpansion.cs

示例9: IsTryGetParameterInvocation

        private static bool IsTryGetParameterInvocation(Expression condition)
        {
            var expression = condition as ReferenceExpression;
            if (expression == null)
                return false;

            return expression.Name.StartsWith("?");
        }
开发者ID:JonKruger,项目名称:MvcContrib,代码行数:8,代码来源:FixTryGetParameterConditionalChecks.cs

示例10: CreateMethodInvocationExpression

 public static MethodInvocationExpression CreateMethodInvocationExpression(LexicalInfo li, Expression target, Expression arg)
 {
     MethodInvocationExpression mie = new MethodInvocationExpression(li);
     mie.Target = (Expression)target.Clone();
     mie.Arguments.Add((Expression)arg.Clone());
     mie.IsSynthetic = true;
     return mie;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:8,代码来源:AstUtil.cs

示例11: FixCondition

		private Expression FixCondition(Expression condition)
		{
			if (IsTryGetParameterInvocation(condition) == false)
				return condition;

			var isNull =
				new MemberReferenceExpression(condition, "_IsIgnoreNullReferencingNotNullObject_");
			return isNull;
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:9,代码来源:FixTryGetParameterConditionalChecks.cs

示例12: IsSpecialMemberTarget

		protected override bool IsSpecialMemberTarget(Expression container)
		{
			if (container.NodeType == NodeType.UnaryExpression)
			{
				UnaryExpression ue = container as UnaryExpression;
				if (ue.Operator == UnaryOperatorType.Indirection)
					return false; //indirected value type, no need to process it specially
			}
			return null != container.ExpressionType && container.ExpressionType.IsValueType;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:10,代码来源:ProcessAssignmentsToValueTypeMembers.cs

示例13: when

		public static Expression when(Expression expression)
		{
			BlockExpression right = new BlockExpression();
			right.Body.Add(new ReturnStatement(expression));
			return new BinaryExpression(
				BinaryOperatorType.Assign,
				new ReferenceExpression("condition"),
				right
			);
		}
开发者ID:JackWangCUMT,项目名称:rhino-dsl,代码行数:10,代码来源:BaseScheduler.cs

示例14: IsTryGetParameterInvocation

		private static bool IsTryGetParameterInvocation(Expression condition)
		{
			var mie = condition as MethodInvocationExpression;
			if (mie == null)
				return false;
			var expression = mie.Target as ReferenceExpression;
			if (expression == null)
				return false;
			return expression.Name == "TryGetParameter";
		}
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:10,代码来源:FixTryGetParameterConditionalChecks.cs

示例15: when

		public static Expression when(Expression expression, Expression action)
		{
			BlockExpression condition = new BlockExpression();
			condition.Body.Add(new ReturnStatement(expression));
			return new MethodInvocationExpression(
				new ReferenceExpression("When"),
				condition,
				action
			);
		}
开发者ID:JackWangCUMT,项目名称:rhino-dsl,代码行数:10,代码来源:BaseOrderActionsDSL.cs


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