Esempio n. 1
0
        protected virtual BoundStatement RewriteForStatement(BoundForStatement node)
        {
            var lowerBound = this.RewriteExpression(node.LowerBound);
            var upperBound = this.RewriteExpression(node.UpperBound);
            var body       = this.RewriteStatement(node.Body);

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

            return(new BoundForStatement(node.Syntax, node.Variable, lowerBound, upperBound, body, node.BreakLabel, node.ContinueLabel));
        }
Esempio n. 2
0
        // private static void WriteDoWhileStatement( BoundDoWhileStatement node , IndentedTextWriter writer )
        // {
        //     writer.WriteKeyword( SyntaxKind.DoKeyword );
        //     writer.WriteLine();
        //     writer.WriteNestedStatement( node.Body );
        //     writer.WriteKeyword( SyntaxKind.WhileKeyword );
        //     writer.WriteSpace();
        //     node.Condition.WriteTo( writer );
        //     writer.WriteLine();
        // }

        private static void WriteForStatement(BoundForStatement node, IndentedTextWriter writer)
        {
            writer.WriteKeyword(SyntaxKind.ForKeyword);
            writer.WriteSpace();
            writer.WriteIdentifier(node.Variable.Name);
            writer.WriteSpace();
            writer.WritePunctuation(SyntaxKind.EqToken);
            writer.WriteSpace();
            node.LowerBound.WriteTo(writer);
            writer.WriteSpace();
            writer.WriteKeyword(SyntaxKind.InKeyword);
            writer.WriteSpace();
            node.UpperBound.WriteTo(writer);
            writer.WriteLine();
            writer.WriteNestedStatement(node.Body);
        }