protected virtual BoundStatement RewriteForStatement(BoundForStatement node) { BoundExpression lowerBound = RewriteExpression(node.LowerBound); BoundExpression upperBound = RewriteExpression(node.UpperBound); BoundStatement body = RewriteStatement(node.Body); if (lowerBound == node.LowerBound && upperBound == node.UpperBound && body == node.Body) { return(node); } return(new BoundForStatement(node.Variable, lowerBound, upperBound, body, node.BreakLabel, node.ContinueLabel)); }
private static void WriteForStatement(BoundForStatement node, IndentedTextWriter writer) { writer.WriteKeyword(SyntaxKind.ForKeyword); writer.WriteWhiteSpace(); writer.WriteIdentifier(node.Variable.Name); writer.WriteWhiteSpace(); writer.WritePunctuation(SyntaxKind.EqualsToken); writer.WriteWhiteSpace(); node.LowerBound.WriteTo(writer); writer.WriteWhiteSpace(); writer.WriteKeyword(SyntaxKind.ToKeyword); writer.WriteWhiteSpace(); node.UpperBound.WriteTo(writer); writer.WriteLine(); writer.WriteNestedStatement(node.Body); }