Exemplo n.º 1
0
        /// <summary>
        /// Generates a final script of the given document. This document has been generated by the build process and
        /// contains the entire script in syntax tree form.
        /// </summary>
        /// <param name="composition"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public override async Task <string> GenerateAsync(ProgramComposition composition, MDKProjectProperties config)
        {
            //var dumper = new PreserveDebugDumper(@"e:\dump0.txt");
            //dumper.Visit(await composition.Document.GetSyntaxRootAsync());

            var simplifier = new CodeSimplifier();

            composition = await simplifier.ProcessAsync(composition, config);

            //dumper = new PreserveDebugDumper(@"e:\dump1.txt");
            //dumper.Visit(await composition.Document.GetSyntaxRootAsync());

            var renamer = new SymbolRenamer();

            composition = await renamer.ProcessAsync(composition, config);

            //dumper = new PreserveDebugDumper(@"e:\dump2.txt");
            //dumper.Visit(await composition.Document.GetSyntaxRootAsync());

            var compactor = new WhitespaceCompactor();

            composition = await compactor.ProcessAsync(composition, config);

            //dumper = new PreserveDebugDumper(@"e:\dump3.txt");
            //dumper.Visit(await composition.Document.GetSyntaxRootAsync());

            var lineWrapper = new LineWrapper();

            composition = await lineWrapper.ProcessAsync(composition, config);

            //dumper = new PreserveDebugDumper(@"e:\dump4.txt");
            //dumper.Visit(await composition.Document.GetSyntaxRootAsync());

            return(await GenerateScriptAsync(composition));
        }
Exemplo n.º 2
0
        public async override Task <string> GenerateAsync(ProgramComposition composition, MDKProjectProperties config)
        {
            //simplify
            var simplifier = new CodeSimplifier();

            composition = await simplifier.ProcessAsync(composition, config);

            //Compact
            var compactor = new WhitespaceCompactor();

            composition = await compactor.ProcessAsync(composition, config);

            //Line Wrapper
            var lineWrapper = new LineWrapper();

            composition = await lineWrapper.ProcessAsync(composition, config);

            return(await base.GenerateScriptAsync(composition));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Generates a final script of the given document. This document has been generated by the build process and
        /// contains the entire script in syntax tree form.
        /// </summary>
        /// <param name="composition"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public override async Task <string> GenerateAsync(ProgramComposition composition, ProjectScriptInfo config)
        {
            var simplifier = new CodeSimplifier();

            composition = await simplifier.ProcessAsync(composition, config);

            var renamer = new SymbolRenamer();

            composition = await renamer.ProcessAsync(composition, config);

            var compactor = new WhitespaceCompactor();

            composition = await compactor.ProcessAsync(composition, config);

            var lineWrapper = new LineWrapper();

            composition = await lineWrapper.ProcessAsync(composition, config);

            // return (await composition.Document.GetTextAsync()).ToString();

            return(await GenerateScriptAsync(composition));
        }