Ejemplo n.º 1
0
 public override SyntaxNode VisitVariableDeclaration(VariableDeclarationSyntax node)
 {
     Console.WriteLine("Found declaration: " + node.GetText() + ". Type " + node.Type + " var " + node.Variables.Count);
     if (node.Variables.Count > 0)
     {
         if (node.Type.ToString() == SyntaxFactory.IdentifierName("float").ToString())
         {
             var genericName   = SyntaxFactory.GenericName(SyntaxFactory.Identifier("SecureFloat"));// = SecureFloat<>
             var newIdentifier = SyntaxFactory.IdentifierName("SecureFloat");
             var newType       = node.Type.ReplaceNode(node.Type, newIdentifier);
             var newNode       = SyntaxFactory.VariableDeclaration(newType, node.Variables);
             Console.WriteLine("t1: " + genericName.ToFullString() + " t2: " + newType.GetFirstToken() + " newNode: " + newNode.ToString() + " [PRESS ENTER]");
             Console.ReadLine();
             return(newNode);
         }
     }
     Console.WriteLine("[PRESS ENTER]");
     Console.ReadLine();
     //TypeSyntax secureFloatSyntax = new TypeSyntax();
     return(base.VisitVariableDeclaration(node));
 }