Inheritance: IIfStatement
Ejemplo n.º 1
0
        public override BoundNode VisitIfStatement(BoundIfStatement node)
        {
            Debug.Assert(node != null);
            var rewrittenCondition = VisitExpression(node.Condition);
            var rewrittenConsequence = VisitStatement(node.Consequence);
            var rewrittenAlternative = VisitStatement(node.AlternativeOpt);
            var syntax = (IfStatementSyntax)node.Syntax;

            // EnC: We need to insert a hidden sequence point to handle function remapping in case 
            // the containing method is edited while methods invoked in the condition are being executed.
            if (this.Instrument && !node.WasCompilerGenerated)
            {
                rewrittenCondition = _instrumenter.InstrumentIfStatementCondition(node, rewrittenCondition, _factory);
            }

            var result = RewriteIfStatement(syntax, rewrittenCondition, rewrittenConsequence, rewrittenAlternative, node.HasErrors);

            // add sequence point before the whole statement
            if (this.Instrument && !node.WasCompilerGenerated)
            {
                result = _instrumenter.InstrumentIfStatement(node, result);
            }

            return result;
        }
        public override BoundNode VisitIfStatement(BoundIfStatement node)
        {
            Debug.Assert(node != null);
            var rewrittenCondition = VisitExpression(node.Condition);
            var rewrittenConsequence = VisitStatement(node.Consequence);
            var rewrittenAlternative = VisitStatement(node.AlternativeOpt);
            var syntax = (IfStatementSyntax)node.Syntax;

            // EnC: We need to insert a hidden sequence point to handle function remapping in case 
            // the containing method is edited while methods invoked in the condition are being executed.
            var result = RewriteIfStatement(syntax, AddConditionSequencePoint(rewrittenCondition, node), rewrittenConsequence, rewrittenAlternative, node.HasErrors);

            // add sequence point before the whole statement
            if (this.GenerateDebugInfo && !node.WasCompilerGenerated)
            {
                result = new BoundSequencePointWithSpan(
                    syntax,
                    result,
                    TextSpan.FromBounds(
                        syntax.IfKeyword.SpanStart,
                        syntax.CloseParenToken.Span.End),
                    node.HasErrors);
            }

            return result;
        }
Ejemplo n.º 3
0
        public override BoundNode VisitIfStatement(BoundIfStatement node)
        {
            Debug.Assert(node != null);
            var rewrittenCondition = VisitExpression(node.Condition);
            var rewrittenConsequence = VisitStatement(node.Consequence);
            var rewrittenAlternative = VisitStatement(node.AlternativeOpt);
            var syntax = (IfStatementSyntax)node.Syntax;
            var result = RewriteIfStatement(syntax, node.Locals, rewrittenCondition, rewrittenConsequence, rewrittenAlternative, node.HasErrors);

            // add sequence point before the whole statement
            if (this.generateDebugInfo && !node.WasCompilerGenerated)
            {
                result = new BoundSequencePointWithSpan(
                    syntax,
                    result,
                    TextSpan.FromBounds(
                        syntax.IfKeyword.SpanStart,
                        syntax.CloseParenToken.Span.End),
                    node.HasErrors);
            }

            return result;
        }
Ejemplo n.º 4
0
 public override BoundExpression InstrumentIfStatementCondition(BoundIfStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
 {
     // EnC: We need to insert a hidden sequence point to handle function remapping in case 
     // the containing method is edited while methods invoked in the condition are being executed.
     return AddConditionSequencePoint(base.InstrumentIfStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
 }
Ejemplo n.º 5
0
 public virtual BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
 {
     Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement);
     return InstrumentStatement(original, rewritten);
 }
Ejemplo n.º 6
0
        private BoundStatement BindIfStatement(IfStatementSyntax node, DiagnosticBag diagnostics)
        {
            Binder binder = this.GetBinder(node.Condition);
            Debug.Assert(binder != null);

            var condition = binder.BindBooleanExpression(node.Condition, diagnostics);
            var consequence = binder.BindPossibleEmbeddedStatement(node.Statement, diagnostics);

            // Note that the else clause does not use the pattern variable binder;
            // pattern variables from the condition are not in scope in the else statement.
            BoundStatement alternative = (node.Else == null) ? null : BindPossibleEmbeddedStatement(node.Else.Statement, diagnostics);

            BoundStatement result = new BoundIfStatement(node, binder.GetDeclaredLocalsForScope(node.Condition), condition, consequence, alternative);
            return result;
        }
Ejemplo n.º 7
0
 public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
 {
     var syntax = (IfStatementSyntax)original.Syntax;
     return new BoundSequencePointWithSpan(
         syntax,
         base.InstrumentIfStatement(original, rewritten),
         TextSpan.FromBounds(
             syntax.IfKeyword.SpanStart,
             syntax.CloseParenToken.Span.End),
         original.HasErrors);
 }
Ejemplo n.º 8
0
 public override BoundExpression InstrumentIfStatementCondition(BoundIfStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
 {
     return Previous.InstrumentIfStatementCondition(original, rewrittenCondition, factory);
 }
Ejemplo n.º 9
0
        private BoundStatement BindIfStatement(IfStatementSyntax node, DiagnosticBag diagnostics)
        {
            var condition = BindBooleanExpression(node.Condition, diagnostics);
            var consequence = BindPossibleEmbeddedStatement(node.Statement, diagnostics);
            BoundStatement alternative = (node.Else == null) ? null : BindPossibleEmbeddedStatement(node.Else.Statement, diagnostics);

            BoundStatement result = new BoundIfStatement(node, condition, consequence, alternative);
            return result;
        }
Ejemplo n.º 10
0
 public virtual BoundExpression InstrumentIfStatementCondition(BoundIfStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
 {
     Debug.Assert(!original.WasCompilerGenerated);
     Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement);
     Debug.Assert(factory != null);
     return rewrittenCondition;
 }
Ejemplo n.º 11
0
 public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
 {
     return Previous.InstrumentIfStatement(original, rewritten);
 }
Ejemplo n.º 12
0
 public override BoundNode VisitIfStatement(BoundIfStatement node)
 {
     Fail(node);
     return(null);
 }
Ejemplo n.º 13
0
 public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
 {
     return(Previous.InstrumentIfStatement(original, rewritten));
 }
Ejemplo n.º 14
0
 public virtual BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
 {
     Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement);
     return(InstrumentStatement(original, rewritten));
 }
Ejemplo n.º 15
0
 public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
 {
     return(AddDynamicAnalysis(original, base.InstrumentIfStatement(original, rewritten)));
 }
Ejemplo n.º 16
0
 public override BoundStatement InstrumentIfStatement(BoundIfStatement original, BoundStatement rewritten)
 {
     return AddDynamicAnalysis(original, base.InstrumentIfStatement(original, rewritten));
 }
Ejemplo n.º 17
0
 public override BoundExpression InstrumentIfStatementCondition(BoundIfStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
 {
     // EnC: We need to insert a hidden sequence point to handle function remapping in case
     // the containing method is edited while methods invoked in the condition are being executed.
     return(AddConditionSequencePoint(base.InstrumentIfStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory));
 }
Ejemplo n.º 18
0
 public override BoundExpression InstrumentIfStatementCondition(BoundIfStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory)
 {
     return(Previous.InstrumentIfStatementCondition(original, rewrittenCondition, factory));
 }