예제 #1
0
        /// <summary>
        /// Rewrites a for ellipsis statement.
        /// </summary>
        /// <param name="node">The for ellipsis statement to rewrite.</param>
        /// <returns>The rewritten for ellipsis statement.</returns>
        protected virtual BoundStatement RewriteForEllipsisStatement(BoundForEllipsisStatement node)
        {
            var lowerBound = RewriteExpression(node.LowerBound);
            var upperBound = RewriteExpression(node.UpperBound);
            var body       = RewriteStatement(node.Body);

            if (lowerBound == node.LowerBound && upperBound == node.UpperBound && body == node.Body)
            {
                return(node);
            }

            return(new BoundForEllipsisStatement(node.Variable, lowerBound, upperBound, body, node.BreakLabel, node.ContinueLabel));
        }
예제 #2
0
 private static void WriteForEllipsisStatement(BoundForEllipsisStatement node, IndentedTextWriter writer)
 {
     writer.WriteKeyword(SyntaxKind.ForKeyword);
     writer.WriteSpace();
     writer.WriteIdentifier(node.Variable.Name);
     writer.WriteSpace();
     writer.WritePunctuation(SyntaxKind.ColonEqualsToken);
     writer.WriteSpace();
     node.LowerBound.WriteTo(writer);
     writer.WriteSpace();
     writer.WriteKeyword(SyntaxKind.EllipsisToken);
     writer.WriteSpace();
     node.UpperBound.WriteTo(writer);
     writer.WriteSpace();
     writer.WriteNestedStatement(node.Body);
 }