Package com.google.gwt.dev.jjs.impl

Examples of com.google.gwt.dev.jjs.impl.JsAbstractTextTransformer


      StatementRanges statementRanges = v.getStatementRanges();
      String code = out.toString();
      Map<Range, SourceInfo> infoMap = (sourceInfoMaps != null) ? v.getSourceInfoMap() : null;

      JsAbstractTextTransformer transformer =
          new JsAbstractTextTransformer(code, statementRanges, infoMap) {
            @Override
            public void exec() {
            }

            @Override
            protected void updateSourceInfoMap() {
            }
          };

      /**
       * Reorder function decls to improve compression ratios. Also restructures
       * the top level blocks into sub-blocks if they exceed 32767 statements.
       */
      Event functionClusterEvent = SpeedTracerLogger.start(CompilerEventType.FUNCTION_CLUSTER);
      // TODO(cromwellian) move to the Js AST, re-enable sourcemaps + clustering
      if (!sourceMapsEnabled
          && options.isAggressivelyOptimize()
          // only cluster for obfuscated mode
          && options.getOutput() == JsOutputOption.OBFUSCATED) {
        transformer = new JsFunctionClusterer(transformer);
        transformer.exec();
      }
      functionClusterEvent.end();

      // rewrite top-level blocks to limit the number of statements
      if (!sourceMapsEnabled && splitBlocks) {
        transformer = new JsIEBlockTextTransformer(transformer);
        transformer.exec();
      }

      js[i] = transformer.getJs();
      ranges[i] = transformer.getStatementRanges();
      if (sizeBreakdowns != null) {
        sizeBreakdowns[i] = v.getSizeBreakdown();
      }
      if (sourceInfoMaps != null) {
        sourceInfoMaps.add(transformer.getSourceInfoMap());
      }
    }
  }
View Full Code Here


        StatementRanges statementRanges = v.getStatementRanges();
        String code = out.toString();
        JsSourceMap infoMap = (sourceInfoMaps != null) ? v.getSourceInfoMap() : null;

        JsAbstractTextTransformer transformer =
            new JsNoopTransformer(code, statementRanges, infoMap);

        /**
         * Cut generated JS up on class boundaries and re-link the source (possibly making use of
         * source from previous compiles, thus making it possible to perform partial recompiles).
         */
        if (options.isIncrementalCompileEnabled()) {
          transformer = new JsTypeLinker(logger, transformer, v.getClassRanges(),
              v.getProgramClassRange(), getMinimalRebuildCache(), jprogram.typeOracle);
          transformer.exec();
        }

        /**
         * Reorder function decls to improve compression ratios. Also restructures the top level
         * blocks into sub-blocks if they exceed 32767 statements.
         */
        Event functionClusterEvent = SpeedTracerLogger.start(CompilerEventType.FUNCTION_CLUSTER);
        // TODO(cromwellian) move to the Js AST optimization, re-enable sourcemaps + clustering
        if (!sourceMapsEnabled && options.shouldClusterSimilarFunctions()
            && options.getNamespace() == JsNamespaceOption.NONE
            && options.getOutput() == JsOutputOption.OBFUSCATED) {
          transformer = new JsFunctionClusterer(transformer);
          transformer.exec();
        }
        functionClusterEvent.end();

        jsFragments[i] = transformer.getJs();
        ranges[i] = transformer.getStatementRanges();
        if (sizeBreakdowns != null) {
          sizeBreakdowns[i] = v.getSizeBreakdown();
        }
        if (sourceInfoMaps != null) {
          sourceInfoMaps.add(transformer.getSourceInfoMap());
        }
      }

      generateJavascriptEvent.end();
    }
View Full Code Here

        StatementRanges statementRanges = v.getStatementRanges();
        String code = out.toString();
        JsSourceMap infoMap = (sourceInfoMaps != null) ? v.getSourceInfoMap() : null;

        JsAbstractTextTransformer transformer =
            new JsAbstractTextTransformer(code, statementRanges, infoMap) {
                @Override
              public void exec() {
              }

                @Override
              protected void updateSourceInfoMap() {
              }
            };

        /**
         * Reorder function decls to improve compression ratios. Also restructures the top level
         * blocks into sub-blocks if they exceed 32767 statements.
         */
        Event functionClusterEvent = SpeedTracerLogger.start(CompilerEventType.FUNCTION_CLUSTER);
        // TODO(cromwellian) move to the Js AST optimization, re-enable sourcemaps + clustering
        if (!sourceMapsEnabled && options.shouldClusterSimilarFunctions()
            && options.getNamespace() == JsNamespaceOption.NONE
            && options.getOutput() == JsOutputOption.OBFUSCATED) {
          transformer = new JsFunctionClusterer(transformer);
          transformer.exec();
        }
        functionClusterEvent.end();

        jsFragments[i] = transformer.getJs();
        ranges[i] = transformer.getStatementRanges();
        if (sizeBreakdowns != null) {
          sizeBreakdowns[i] = v.getSizeBreakdown();
        }
        if (sourceInfoMaps != null) {
          sourceInfoMaps.add(transformer.getSourceInfoMap());
        }
      }
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.jjs.impl.JsAbstractTextTransformer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.