Пример #1
0
 private static void WriteVariableDeclaration(BoundVariableDeclaration node, IndentedTextWriter writer)
 {
     writer.WriteKeyword(node.Variable.IsReadOnly ? SyntaxKind.SetKeyword : SyntaxKind.VarKeyword);
     writer.WriteSpace();
     writer.WriteIdentifier(node.Variable.Name);
     writer.WriteSpace();
     writer.WritePunctuation(SyntaxKind.AssignToken);
     writer.WriteSpace();
     node.Initializer.WriteTo(writer);
     writer.WriteLine();
 }
Пример #2
0
        protected virtual BoundStatement RewriteVariableDeclaration(BoundVariableDeclaration node)
        {
            if (node.Initializer == null)
            {
                return(node);
            }

            var initializer = RewriteExpression(node.Initializer);

            if (initializer == node.Initializer)
            {
                return(node);
            }

            return(new BoundVariableDeclaration(node.Variable, initializer));
        }