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


C# ExprContext类代码示例

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


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

示例1: FalseLiteralContext

		public FalseLiteralContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例2: VisitExpression

        public BoundExpression VisitExpression(BoundExpression node, ExprContext context)
        {
            var prevContext = _context;
            int prevStack = StackDepth();
            _context = context;

            // Do not recurse into constant expressions. Their children do not push any values.
            var result = node.ConstantValue == null ?
                node = (BoundExpression)base.Visit(node) :
                node;

            _context = prevContext;
            _counter += 1;

            switch (context)
            {
                case ExprContext.Sideeffects:
                    SetStackDepth(prevStack);
                    break;

                case ExprContext.AssignmentTarget:
                    break;

                case ExprContext.Value:
                case ExprContext.Address:
                case ExprContext.Box:
                    SetStackDepth(prevStack);
                    PushEvalStack(node, context);
                    break;

                default:
                    throw ExceptionUtilities.UnexpectedValue(context);
            }

            return result;
        }
开发者ID:rosslyn-cuongle,项目名称:roslyn,代码行数:36,代码来源:Optimizer.cs

示例3: VisitExpression

        private BoundExpression VisitExpression(BoundExpression node, ExprContext context)
        {
            BoundExpression result;
            _recursionDepth++;

            if (_recursionDepth > 1)
            {
                StackGuard.EnsureSufficientExecutionStack(_recursionDepth);

                result = VisitExpressionCore(node, context);
            }
            else
            {
                result = VisitExpressionCoreWithStackGuard(node, context);
            }

            _recursionDepth--;
            return result;
        }
开发者ID:otawfik-ms,项目名称:roslyn,代码行数:19,代码来源:Optimizer.cs

示例4: PushEvalStack

 private void PushEvalStack(BoundExpression result, ExprContext context)
 {
     Debug.Assert(result != null || context == ExprContext.None);
     _evalStack.Add((result, context));
 }
开发者ID:otawfik-ms,项目名称:roslyn,代码行数:5,代码来源:Optimizer.cs

示例5: VisitExpression

        public BoundExpression VisitExpression(BoundExpression node, ExprContext context)
        {
            var prevContext = _context;
            int prevStack = _evalStack;

            _context = context;
            var result = ReuseOrVisit(node, context);
            _counter += 1;

            switch (context)
            {
                case ExprContext.Sideeffects:
                    _evalStack = prevStack;
                    break;

                case ExprContext.Value:
                case ExprContext.Address:
                case ExprContext.Box:
                    _evalStack = prevStack + 1;
                    break;

                case ExprContext.AssignmentTarget:
                    _evalStack = prevStack;
                    if (LhsUsesStackWhenAssignedTo(node, context))
                    {
                        _evalStack = prevStack + 1;
                    }
                    break;

                default:
                    throw ExceptionUtilities.UnexpectedValue(context);
            }

            _context = prevContext;
            return result;
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:36,代码来源:Optimizer.cs

示例6: LhsUsesStackWhenAssignedTo

        // here we have a case of indirect assignment:  *t1 = expr;
        // normally we would need to push t1 and that will cause spilling of t2
        //
        // TODO: an interesting case arises in unused x[i]++  and ++x[i] :
        //       we have trees that look like:
        //
        //  t1 = &(x[0])
        //  t2 = *t1
        //  *t1 = t2 + 1
        //
        //  t1 = &(x[0])
        //  t2 = *t1 + 1
        //  *t1 = t2
        //
        //  in these cases, we could keep t2 on stack (dev10 does).
        //  we are dealing with exactly 2 locals and access them in strict order 
        //  t1, t2, t1, t2  and we are not using t2 after that.
        //  We may consider detecting exactly these cases and pretend that we do not need 
        //  to push either t1 or t2 in this case.
        //
        private bool LhsUsesStackWhenAssignedTo(BoundNode node, ExprContext context)
        {
            Debug.Assert(context == ExprContext.AssignmentTarget);

            switch (node.Kind)
            {
                case BoundKind.Parameter:
                case BoundKind.Local:
                    return false;

                case BoundKind.FieldAccess:
                    return !((BoundFieldAccess)node).FieldSymbol.IsStatic;

                case BoundKind.Sequence:
                    return LhsUsesStackWhenAssignedTo(((BoundSequence)node).Value, context);
            }

            return true;
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:39,代码来源:Optimizer.cs

示例7: IfStatementContext

		public IfStatementContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例8: SignContext

		public SignContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例9: TrueLiteralContext

		public TrueLiteralContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例10: IndexContext

		public IndexContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例11: InfLiteralContext

		public InfLiteralContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例12: FunctionCallContext

		public FunctionCallContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例13: ComplexLiteralContext

		public ComplexLiteralContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs

示例14: expr

	public ExprContext expr() {
		ExprContext _localctx = new ExprContext(Context, State);
		EnterRule(_localctx, 112, RULE_expr);
		int _la;
		try {
			EnterOuterAlt(_localctx, 1);
			{
			State = 748; xor_expr();
			State = 753;
			ErrorHandler.Sync(this);
			_la = TokenStream.La(1);
			while (_la==OR_OP) {
				{
				{
				State = 749; Match(OR_OP);
				State = 750; xor_expr();
				}
				}
				State = 755;
				ErrorHandler.Sync(this);
				_la = TokenStream.La(1);
			}
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			ErrorHandler.ReportError(this, re);
			ErrorHandler.Recover(this, re);
		}
		finally {
			ExitRule();
		}
		return _localctx;
	}
开发者ID:ashwinjv,项目名称:PythonParser,代码行数:34,代码来源:Python3Parser.cs

示例15: UserOpContext

		public UserOpContext(ExprContext context) { CopyFrom(context); }
开发者ID:mpmedia,项目名称:Excess,代码行数:1,代码来源:RParser.cs


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