public override BoundNode VisitWhileStatement(BoundWhileStatement node) { Debug.Assert(node != null); var rewrittenCondition = (BoundExpression)Visit(node.Condition); var rewrittenBody = (BoundStatement)Visit(node.Body); TextSpan conditionSequencePointSpan = default(TextSpan); if (this.GenerateDebugInfo) { if (!node.WasCompilerGenerated) { WhileStatementSyntax whileSyntax = (WhileStatementSyntax)node.Syntax; conditionSequencePointSpan = TextSpan.FromBounds( whileSyntax.WhileKeyword.SpanStart, whileSyntax.CloseParenToken.Span.End); } } // 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(RewriteWhileStatement( node.Syntax, AddConditionSequencePoint(rewrittenCondition, node), conditionSequencePointSpan, rewrittenBody, node.BreakLabel, node.ContinueLabel, node.HasErrors)); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { Debug.Assert(node != null); var rewrittenCondition = (BoundExpression)Visit(node.Condition); var rewrittenBody = (BoundStatement)Visit(node.Body); TextSpan conditionSequencePointSpan = default(TextSpan); if (this.GenerateDebugInfo) { if (!node.WasCompilerGenerated) { WhileStatementSyntax whileSyntax = (WhileStatementSyntax)node.Syntax; conditionSequencePointSpan = TextSpan.FromBounds( whileSyntax.WhileKeyword.SpanStart, whileSyntax.CloseParenToken.Span.End); } } return(RewriteWhileStatement( node.Syntax, AddConditionSequencePoint(rewrittenCondition, node), conditionSequencePointSpan, rewrittenBody, node.BreakLabel, node.ContinueLabel, node.HasErrors)); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { AddAll(node.Locals); base.VisitWhileStatement(node); RemoveAll(node.Locals); return(null); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { Debug.Assert(node != null); var rewrittenCondition = (BoundExpression)Visit(node.Condition); var rewrittenBody = (BoundStatement)Visit(node.Body); TextSpan conditionSequencePointSpan = default(TextSpan); if (this.GenerateDebugInfo) { if (!node.WasCompilerGenerated) { WhileStatementSyntax whileSyntax = (WhileStatementSyntax)node.Syntax; conditionSequencePointSpan = TextSpan.FromBounds( whileSyntax.WhileKeyword.SpanStart, whileSyntax.CloseParenToken.Span.End); } } return RewriteWhileStatement( node.Syntax, node.InnerLocals, AddConditionSequencePoint(rewrittenCondition, node), conditionSequencePointSpan, rewrittenBody, node.BreakLabel, node.ContinueLabel, node.HasErrors); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { Debug.Assert(node != null); var rewrittenCondition = (BoundExpression)Visit(node.Condition); var rewrittenBody = (BoundStatement)Visit(node.Body); TextSpan conditionSequencePointSpan = default(TextSpan); if (this.GenerateDebugInfo) { if (!node.WasCompilerGenerated) { WhileStatementSyntax whileSyntax = (WhileStatementSyntax)node.Syntax; conditionSequencePointSpan = TextSpan.FromBounds( whileSyntax.WhileKeyword.SpanStart, whileSyntax.CloseParenToken.Span.End); } } // 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 RewriteWhileStatement( node.Syntax, AddConditionSequencePoint(rewrittenCondition, node), conditionSequencePointSpan, rewrittenBody, node.BreakLabel, node.ContinueLabel, node.HasErrors); }
public virtual BoundExpression InstrumentWhileStatementCondition(BoundWhileStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory) { Debug.Assert(!original.WasCompilerGenerated); Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); Debug.Assert(factory != null); return(rewrittenCondition); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { if (IsInside) { _labelsInside.Add(node.BreakLabel); } return(base.VisitWhileStatement(node)); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { Debug.Assert(node != null); var rewrittenCondition = VisitExpression(node.Condition); var rewrittenBody = VisitStatement(node.Body); Debug.Assert(rewrittenBody is { });
public override BoundStatement InstrumentWhileStatementConditionalGotoStart(BoundWhileStatement original, BoundStatement ifConditionGotoStart) { WhileStatementSyntax whileSyntax = (WhileStatementSyntax)original.Syntax; TextSpan conditionSequencePointSpan = TextSpan.FromBounds( whileSyntax.WhileKeyword.SpanStart, whileSyntax.CloseParenToken.Span.End); return(new BoundSequencePointWithSpan(whileSyntax, base.InstrumentWhileStatementConditionalGotoStart(original, ifConditionGotoStart), conditionSequencePointSpan)); }
public virtual BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak( BoundWhileStatement original, BoundStatement ifConditionGotoStart ) { Debug.Assert(!original.WasCompilerGenerated); Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); return(ifConditionGotoStart); }
public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak( BoundWhileStatement original, BoundStatement ifConditionGotoStart ) { return(Previous.InstrumentWhileStatementConditionalGotoStartOrBreak( original, ifConditionGotoStart )); }
public override BoundExpression InstrumentWhileStatementCondition( BoundWhileStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory ) { return(Previous.InstrumentWhileStatementCondition( original, rewrittenCondition, factory )); }
private BoundStatement RewriteWhileStatement( BoundWhileStatement loop, ImmutableArray <LocalSymbol> locals, BoundExpression rewrittenCondition, BoundStatement rewrittenBody, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors) { if (locals.IsEmpty) { return(RewriteWhileStatement(loop, rewrittenCondition, rewrittenBody, breakLabel, continueLabel, hasErrors)); } // We need to enter scope-block from the top, that is where an instance of a display class will be created // if any local is captured within a lambda. // while (condition) // body; // // becomes // // continue: // { // GotoIfFalse condition break; // body // goto continue; // } // break: SyntaxNode syntax = loop.Syntax; BoundStatement continueLabelStatement = new BoundLabelStatement(syntax, continueLabel); BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, breakLabel); if (this.Instrument && !loop.WasCompilerGenerated) { ifNotConditionGotoBreak = _instrumenter.InstrumentWhileStatementConditionalGotoStartOrBreak(loop, ifNotConditionGotoBreak); continueLabelStatement = new BoundSequencePoint(null, continueLabelStatement); } return(BoundStatementList.Synthesized(syntax, hasErrors, continueLabelStatement, new BoundBlock(syntax, locals, ImmutableArray.Create( ifNotConditionGotoBreak, rewrittenBody, new BoundGotoStatement(syntax, continueLabel))), new BoundLabelStatement(syntax, breakLabel))); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { Debug.Assert(node != null); var rewrittenCondition = (BoundExpression)Visit(node.Condition); var rewrittenBody = (BoundStatement)Visit(node.Body); // 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 (!node.WasCompilerGenerated && this.Instrument) { rewrittenCondition = _instrumenter.InstrumentWhileStatementCondition(node, rewrittenCondition, _factory); } return(RewriteWhileStatement( node, rewrittenCondition, rewrittenBody, node.BreakLabel, node.ContinueLabel, node.HasErrors)); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { Debug.Assert(node != null); var rewrittenCondition = (BoundExpression)Visit(node.Condition); var rewrittenBody = (BoundStatement)Visit(node.Body); // 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 (!node.WasCompilerGenerated && this.Instrument) { rewrittenCondition = _instrumenter.InstrumentWhileStatementCondition(node, rewrittenCondition, _factory); } return RewriteWhileStatement( node, rewrittenCondition, rewrittenBody, node.BreakLabel, node.ContinueLabel, node.HasErrors); }
private BoundStatement RewriteWhileStatement( BoundWhileStatement loop, ImmutableArray<LocalSymbol> locals, BoundExpression rewrittenCondition, BoundStatement rewrittenBody, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors) { if (locals.IsEmpty) { return RewriteWhileStatement(loop, rewrittenCondition, rewrittenBody, breakLabel, continueLabel, hasErrors); } // We need to enter scope-block from the top, that is where an instance of a display class will be created // if any local is captured within a lambda. // while (condition) // body; // // becomes // // continue: // { // GotoIfFalse condition break; // body // goto continue; // } // break: SyntaxNode syntax = loop.Syntax; BoundStatement continueLabelStatement = new BoundLabelStatement(syntax, continueLabel); BoundStatement ifNotConditionGotoBreak = new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, breakLabel); if (this.Instrument && !loop.WasCompilerGenerated) { ifNotConditionGotoBreak = _instrumenter.InstrumentWhileStatementConditionalGotoStartOrBreak(loop, ifNotConditionGotoBreak); continueLabelStatement = new BoundSequencePoint(null, continueLabelStatement); } return BoundStatementList.Synthesized(syntax, hasErrors, continueLabelStatement, new BoundBlock(syntax, locals, ImmutableArray.Create( ifNotConditionGotoBreak, rewrittenBody, new BoundGotoStatement(syntax, continueLabel))), new BoundLabelStatement(syntax, breakLabel)); }
public override BoundStatement InstrumentWhileStatementGotoContinue(BoundWhileStatement original, BoundStatement gotoContinue) { return new BoundSequencePoint(null, base.InstrumentWhileStatementGotoContinue(original, gotoContinue)); }
public override BoundStatement InstrumentWhileStatementConditionalGotoStart(BoundWhileStatement original, BoundStatement ifConditionGotoStart) { WhileStatementSyntax whileSyntax = (WhileStatementSyntax)original.Syntax; TextSpan conditionSequencePointSpan = TextSpan.FromBounds( whileSyntax.WhileKeyword.SpanStart, whileSyntax.CloseParenToken.Span.End); return new BoundSequencePointWithSpan(whileSyntax, base.InstrumentWhileStatementConditionalGotoStart(original, ifConditionGotoStart), conditionSequencePointSpan); }
public override BoundExpression InstrumentWhileStatementCondition(BoundWhileStatement 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.InstrumentWhileStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory); }
public override BoundNode VisitWhileStatement(BoundWhileStatement node) { if (IsInside) { _labelsInside.Add(node.BreakLabel); } return base.VisitWhileStatement(node); }
public virtual BoundStatement InstrumentWhileStatementConditionalGotoStart(BoundWhileStatement original, BoundStatement ifConditionGotoStart) { Debug.Assert(!original.WasCompilerGenerated); Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); return ifConditionGotoStart; }
public override BoundStatement InstrumentWhileStatementGotoContinue(BoundWhileStatement original, BoundStatement gotoContinue) { return Previous.InstrumentWhileStatementGotoContinue(original, gotoContinue); }
public override BoundStatement InstrumentWhileStatementConditionalGotoStart(BoundWhileStatement original, BoundStatement ifConditionGotoStart) { return Previous.InstrumentWhileStatementConditionalGotoStart(original, ifConditionGotoStart); }
public override BoundExpression InstrumentWhileStatementCondition(BoundWhileStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory) { return Previous.InstrumentWhileStatementCondition(original, rewrittenCondition, factory); }
public override BoundStatement InstrumentWhileStatementConditionalGotoStart(BoundWhileStatement original, BoundStatement ifConditionGotoStart) { return AddDynamicAnalysis(original, base.InstrumentWhileStatementConditionalGotoStart(original, ifConditionGotoStart)); }
public virtual BoundStatement InstrumentWhileStatementGotoContinue(BoundWhileStatement original, BoundStatement gotoContinue) { Debug.Assert(!original.WasCompilerGenerated); Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); return gotoContinue; }
public override BoundStatement InstrumentWhileStatementConditionalGotoStartOrBreak(BoundWhileStatement original, BoundStatement ifConditionGotoStart) { return(AddDynamicAnalysis(original, base.InstrumentWhileStatementConditionalGotoStartOrBreak(original, ifConditionGotoStart))); }
public override BoundStatement InstrumentWhileStatementGotoContinue(BoundWhileStatement original, BoundStatement gotoContinue) { return(Previous.InstrumentWhileStatementGotoContinue(original, gotoContinue)); }
public override BoundExpression InstrumentWhileStatementCondition(BoundWhileStatement 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.InstrumentWhileStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory)); }
public virtual BoundExpression InstrumentWhileStatementCondition(BoundWhileStatement original, BoundExpression rewrittenCondition, SyntheticBoundNodeFactory factory) { Debug.Assert(!original.WasCompilerGenerated); Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); Debug.Assert(factory != null); return rewrittenCondition; }
public override BoundStatement InstrumentWhileStatementGotoContinue(BoundWhileStatement original, BoundStatement gotoContinue) { return(new BoundSequencePoint(null, base.InstrumentWhileStatementGotoContinue(original, gotoContinue))); }
public virtual BoundStatement InstrumentWhileStatementGotoContinue(BoundWhileStatement original, BoundStatement gotoContinue) { Debug.Assert(!original.WasCompilerGenerated); Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); return(gotoContinue); }