public override void VisitDoStatement <TExpression, TStatement>(IDoStatement <TExpression, TStatement> doStatement) { Value = new Statement() { DoStatement = new DoStatementFactory(doStatement).Value }; }
public override void VisitDoStatement(IDoStatement stmt, IList <IStatement> body) { if (IsTargetMatch(stmt, CompletionCase.EmptyCompletionBefore)) { body.Add(EmptyCompletionExpression); } var loop = new DoLoop { Condition = _exprVisitor.ToLoopHeaderExpression(stmt.Condition, body) }; body.Add(loop); if (IsTargetMatch(stmt, CompletionCase.InBody)) { loop.Body.Add(EmptyCompletionExpression); } stmt.Body.Accept(this, loop.Body); if (IsTargetMatch(stmt, CompletionCase.EmptyCompletionAfter)) { body.Add(EmptyCompletionExpression); } }
private static void WriteDo(LanguageWriter w, IDoStatement state) { w.WriteKeyword("do"); w.PushScope(); w.Write(" {"); w.WriteLine(); w.WriteIndent(); if (state.Body != null) { WriteBlock(w, state.Body); } w.WriteOutdent(); w.Write("} "); w.PopScope(); w.WriteKeyword("while"); w.Write("("); if (state.Condition != null) { w.SkipWriteLine = true; ExpressionWriter.WriteExpression(w, state.Condition, false); w.SkipWriteLine = false; } w.Write(");"); w.WriteLine(); }
public static void VisitDoStatementChildren <TExpression, TStatement>( IDoStatement <TExpression, TStatement> doStatement, IGenericStatementVisitor visitor) where TExpression : IExpression where TStatement : IStatement { VisitIfNotNull(doStatement.Statement, visitor); }
public override void VisitDoStatement <TExpression, TStatement>(IDoStatement <TExpression, TStatement> doStatement) { Steps.Add(new WriteDoKeyword()); Steps.AddIndentedStatementSteps(doStatement.Statement); Steps.Add(doStatement.Statement is IBlockStatement ? (ISourceCodeBuilderStep) new WriteWhitespace() : new WriteIndentedNewLine()); Steps.Add(new WriteWhileKeyword()); Steps.Add(new WriteWhitespace()); Steps.Add(new WriteStartParenthesis()); Steps.Add(new WriteExpression <TExpression>(doStatement.Condition)); Steps.Add(new WriteEndParenthesis()); Steps.Add(new WriteSemicolon()); }
public override void VisitDoStatement(IDoStatement value) { _formatter.WriteKeyword("do"); _formatter.WriteLine(); _formatter.Write("{"); _formatter.WriteLine(); _formatter.WriteIndent(); VisitBlockStatement(value.Body); _formatter.WriteOutdent(); _formatter.Write("} "); _formatter.WriteKeyword("until"); WriteWhitespace(); _formatter.Write("("); VisitExpression(value.Condition); _formatter.Write(")"); _formatter.WriteLine(); }
protected CognitiveComplexityHintBase(ITreeNode node, DocumentOffset offset, int value) { _node = node; _offset = offset; Value = value; Description = node switch { IWhileStatement _ => "While-Statement (increases nesting)", ISwitchStatement _ => "Switch-Statement (increases nesting)", IDoStatement _ => "Do-While-Statement (increases nesting)", IIfStatement _ => "If-Statement (increases nesting)", IForStatement _ => "For-Statement (increases nesting)", IForeachStatement _ => "Foreach-Statement (increases nesting)", ICatchClause _ => "Catch-Clause (increases nesting)", IGotoStatement _ => "Goto-Statement", IBreakStatement _ => "Break-Statement", IConditionalOrExpression _ => "First/alternating conditional Expression", IConditionalAndExpression _ => "First/alternating conditional Expression", ICSharpStatement _ => "If-Statement (increases nesting)", ICSharpExpression _ => "Recursive Call", _ => throw new NotSupportedException(node.GetType().FullName) }; }
public virtual void VisitDoStatement <TExpression, TStatement>(IDoStatement <TExpression, TStatement> doStatement) where TExpression : IExpression where TStatement : IStatement { Visit(doStatement); }
public override void VisitDoStatement(IDoStatement doStatement, IHighlightingConsumer consumer) { VisitLoop(doStatement, consumer); }
public virtual void VisitDoStatement(IDoStatement value) { VisitExpression(value.Condition); VisitStatement(value.Body); }
private void WriteDoStatement(IDoStatement statement, IFormatter formatter) { this.WriteStatementSeparator(formatter); formatter.WriteKeyword("do"); formatter.Write(" {"); formatter.WriteLine(); formatter.WriteIndent(); if (statement.Body != null) { this.WriteStatement(statement.Body, formatter); } formatter.WriteLine(); formatter.WriteOutdent(); formatter.Write("} "); formatter.WriteKeyword("while"); formatter.Write(" ("); if (statement.Condition != null) { this.WriteExpression(statement.Condition, formatter); } else { formatter.WriteLiteral("true"); } formatter.Write(" );"); }
public virtual void VisitDoStatement(IDoStatement value) { this.VisitExpression(value.Condition); this.VisitStatement(value.Body); }
public virtual IStatement TransformDoStatement(IDoStatement value) { value.Condition = this.TransformExpression(value.Condition); value.Body = (IBlockStatement)this.TransformStatement(value.Body); return value; }