コード例 #1
0
 private static void WriteForStatement(BoundForStatement node, IndentedTextWriter writer)
 {
     writer.WriteKeyword(SyntaxKind.ForKeyword);
     writer.WriteSpace();
     writer.WriteKeyword(SyntaxKind.OpenParenthesisToken);
     writer.WriteNestedStatement(node.Variable);
     writer.WriteSpace();
     writer.WriteNestedExpression(0, node.Condition);
     writer.WriteSpace();
     writer.WriteNestedExpression(0, node.Action);
     writer.WriteKeyword(SyntaxKind.CloseParenthesisToken);
     writer.WriteLine();
     writer.WriteNestedStatement(node.Body);
 }
コード例 #2
0
        protected virtual BoundStatement RewriteForStatement(BoundForStatement node)
        {
            var variable  = RewriteVariableDeclaration((BoundVariableDeclaration)node.Variable);
            var condition = RewriteExpression(node.Condition);
            var action    = RewriteExpression(node.Action);
            var body      = RewriteStatement(node.Body);

            if (variable == node.Variable && condition == node.Condition && action == node.Action && body == node.Body)
            {
                return(node);
            }

            return(new BoundForStatement(node.Variable, condition, action, body, node.BreakLabel, node.ContinueLabel));
        }