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


C# BoundExpressionStatement.Update方法代码示例

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


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

示例1: VisitExpressionStatement

        // All nodes with a single child expression are rewritten in the same manner.
        //
        // If the node is an expression and the child contains an await expression, then the rewriting transforms:
        //     Expression(Spill(sideEffects, Value))
        // to:
        //     Spill(sideEffects, Expression(Value))
        //
        // If the node is a statement and the child contains an await expression, then the rewriting transforms:
        //     ExpressionStatement(Spill(sideEffects, Value))
        // to:
        //     Block(sideEffects, ExpressionStatement(Value))
        //
        // If the child expression does not contain an await expression then no rewriting is performed.

        public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
        {
            BoundExpression expression = (BoundExpression)this.Visit(node.Expression);

            if (expression.Kind != BoundKind.SpillSequence)
            {
                return node.Update(expression);
            }

            return RewriteSpillSequenceAsBlock((BoundSpillSequence)expression);
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:25,代码来源:AwaitLoweringRewriterPass1_Unary.cs

示例2: VisitExpressionStatement

        public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
        {
            var syntax = node.Syntax;
            var loweredExpression = VisitUnusedExpression(node.Expression);

            if (loweredExpression == null)
            {
                // NOTE: not using a BoundNoOpStatement, since we don't want a nop to be emitted.
                // CONSIDER: could use a BoundNoOpStatement (DevDiv #12943).
                return BoundStatementList.Synthesized(syntax);
            }
            else
            {
                return AddSequencePoint(node.Update(loweredExpression));
            }
        }
开发者ID:riversky,项目名称:roslyn,代码行数:16,代码来源:LocalRewriter_ExpressionStatement.cs

示例3: RewriteExpressionStatement

        private BoundStatement RewriteExpressionStatement(BoundExpressionStatement node, bool suppressInstrumentation = false)
        {
            var loweredExpression = VisitUnusedExpression(node.Expression);

            if (loweredExpression == null)
            {
                return null;
            }
            else
            {
                BoundStatement result = node.Update(loweredExpression);
                if (!suppressInstrumentation && this.Instrument && !node.WasCompilerGenerated)
                {
                    result = _instrumenter.InstrumentExpressionStatement(node, result);
                }

                return result;
            }
        }
开发者ID:Rickinio,项目名称:roslyn,代码行数:19,代码来源:LocalRewriter_ExpressionStatement.cs

示例4: VisitExpressionStatement

        public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
        {
            BoundSpillSequence2 ss = null;
            BoundExpression expr;

            if (node.Expression.Kind == BoundKind.AwaitExpression)
            {
                // await expression with result discarded
                var awaitExpression = (BoundAwaitExpression)node.Expression;
                var expression = VisitExpression(ref ss, awaitExpression.Expression);
                expr = awaitExpression.Update(expression, awaitExpression.GetAwaiter, awaitExpression.IsCompleted, awaitExpression.GetResult, awaitExpression.Type);
            }
            else
            {
                expr = VisitExpression(ref ss, node.Expression);
            }

            Debug.Assert(expr != null);
            Debug.Assert(ss == null || ss.Value == null);
            BoundStatement replacement = UpdateStatement(ss, node.Update(expr));
            return replacement;
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:22,代码来源:AwaitLiftingRewriter.cs

示例5: VisitExpressionStatement

 public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
 {
     // ref assignments might be translated away (into nothing).  If so just
     // return no statement.  The enclosing statement list will just omit it.
     BoundExpression expression = (BoundExpression)this.Visit(node.Expression);
     return (expression == null) ? null : node.Update(expression);
 }
开发者ID:nagyist,项目名称:roslyn,代码行数:7,代码来源:StateMachineMethodToClassRewriter.cs

示例6: VisitExpressionStatement

            public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
            {
                if (node.Expression.Kind == BoundKind.AwaitExpression)
                {
                    var awaitExpression = VisitAwaitExpression((BoundAwaitExpression)node.Expression, resultsDiscarded: true);
                    return node.Update(awaitExpression);
                }

                return base.VisitExpressionStatement(node);
            }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:10,代码来源:AsyncMethodToClassRewriter.cs

示例7: VisitExpressionStatement

        public override BoundNode VisitExpressionStatement(BoundExpressionStatement node)
        {
            if (node.Expression.Kind == BoundKind.AwaitExpression)
            {
                return VisitAwaitExpression((BoundAwaitExpression)node.Expression, resultPlace: null);
            }

            else if (node.Expression.Kind == BoundKind.AssignmentOperator)
            {
                var expression = (BoundAssignmentOperator)node.Expression;
                if (expression.Right.Kind == BoundKind.AwaitExpression)
                {
                    return VisitAwaitExpression((BoundAwaitExpression)expression.Right, resultPlace: expression.Left);
                }
            }

            BoundExpression expr = (BoundExpression)this.Visit(node.Expression);
            return (expr != null) ? node.Update(expr) : (BoundStatement)F.Block();
        }
开发者ID:rafaellincoln,项目名称:roslyn,代码行数:19,代码来源:AsyncMethodToStateMachineRewriter.cs


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