Inheritance: ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor
Exemple #1
0
        private void CompressMembers()
        {
            var membersVisitor = new MinifyMembersAstVisitor(IgnoredIdentifiers, Options.ConsoleApp, Options.PublicCompressing, Options.ToStringMethodsRemoving);

            CompileAndAcceptVisitor(membersVisitor);
            var substitutor  = new Substitutor(new MinIdGenerator());
            var ignoredNames = new List <string>(IgnoredIdentifiers);

            ignoredNames.AddRange(membersVisitor.NotMembersIdNames);
            var substituton = substitutor.Generate(membersVisitor.TypesMembers, ignoredNames.ToArray());

            var astSubstitution = new Dictionary <string, List <Tuple <string, List <AstNode> > > >();

            foreach (var typeMembers in membersVisitor.TypesMembers)
            {
                var typeMembersAstNodes = new List <Tuple <string, List <AstNode> > >();
                astSubstitution[typeMembers.Key] = typeMembersAstNodes;
                var membersSubst = substituton[typeMembers.Key];
                foreach (NameNode member in typeMembers.Value)
                {
                    typeMembersAstNodes.Add(new Tuple <string, List <AstNode> >(membersSubst[member.Name], GetResolvedNodes(ResolveResultType.Member, member.Node)));
                }
            }

            RenameOrRemoveNodes(astSubstitution, true, Options.MembersCompressing);
        }
Exemple #2
0
        private void CompressMembers()
        {
            var membersVisitor = new MinifyMembersAstVisitor(IgnoredIdentifiers, Options.ConsoleApp, Options.PublicCompressing, Options.ToStringMethodsRemoving);
            CompileAndAcceptVisitor(membersVisitor);
            var substitutor = new Substitutor(new MinIdGenerator());
            var ignoredNames = new List<string>(IgnoredIdentifiers);
            ignoredNames.AddRange(membersVisitor.NotMembersIdNames);
            var substituton = substitutor.Generate(membersVisitor.TypesMembers, ignoredNames.ToArray());

            var astSubstitution = new Dictionary<string, List<Tuple<string, List<AstNode>>>>();
            foreach (var typeMembers in membersVisitor.TypesMembers)
            {
                var typeMembersAstNodes = new List<Tuple<string, List<AstNode>>>();
                astSubstitution[typeMembers.Key] = typeMembersAstNodes;
                var membersSubst = substituton[typeMembers.Key];
                foreach (NameNode member in typeMembers.Value)
                    typeMembersAstNodes.Add(new Tuple<string, List<AstNode>>(membersSubst[member.Name], GetResolvedNodes(ResolveResultType.Member, member.Node)));
            }

            RenameOrRemoveNodes(astSubstitution, true, Options.MembersCompressing);
        }