Package com.google.gwt.thirdparty.debugging.sourcemap.SourceMapGeneratorV3

Examples of com.google.gwt.thirdparty.debugging.sourcemap.SourceMapGeneratorV3.ExtensionMergeAction


            "\"mappings\":\"\",\n" +
            "\"sources\":[\"testcode2\"],\n" +
            "\"names\":[],\n" +
            "\"x_company_baz\":3,\n" +
            "\"x_company_bar\":false\n" +
            "}\n", new ExtensionMergeAction() {
      @Override
      public Object merge(String extensionKey, Object currentValue,
          Object newValue) {
        return (Integer) currentValue
            + ((JsonPrimitive) newValue).getAsInt();
View Full Code Here


  private String javascript;

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    generator = new SourceMapGeneratorV3();
    writer = new SourceMappingWriter(generator);
  }
View Full Code Here

  private List<SyntheticArtifact> createArtifacts()
      throws IOException, SourceMapParseException {
    Event event = SpeedTracerLogger.start(CompilerEventType.SOURCE_MAP_RECORDER);
    List<SyntheticArtifact> toReturn = Lists.newArrayList();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    SourceMapGeneratorV3 generator = new SourceMapGeneratorV3();
    int fragment = 0;
    for (JsSourceMap sourceMap : fragmentMaps) {
      generator.reset();

      if (sourceRoot != null) {
        generator.setSourceRoot(sourceRoot);
      }
      addExtensions(generator, fragment);
      addMappings(new SourceMappingWriter(generator), sourceMap);

      baos.reset();
      OutputStreamWriter out = new OutputStreamWriter(baos);
      generator.appendTo(out, "sourceMap" + fragment);
      out.flush();
      toReturn.add(new SymbolMapsLinker.SourceMapArtifact(permutationId, fragment,
          baos.toByteArray(), sourceRoot));
      fragment++;
    }
View Full Code Here

        SyntheticArtifact emArt = null;
        // no need to adjust source map
        if (editArtifact == null) {
          emArt = emitSourceMapString(logger, sourceMapString, partialPath);
        } else {
          SourceMapGeneratorV3 sourceMapGenerator = new SourceMapGeneratorV3();

          if (se.getSourceRoot() != null) {
            // Reapply source root since mergeMapSection() will not copy it.
            sourceMapGenerator.setSourceRoot(se.getSourceRoot());
          }

          try {
            int totalPrefixLines = 0;
            for (ScriptFragmentEditsArtifact.EditOperation op : editArtifact.editOperations) {
              if (op.getOp() == ScriptFragmentEditsArtifact.Edit.PREFIX) {
                totalPrefixLines += op.getNumLines();
              }
            }
            // TODO(cromwellian): apply insert and remove edits
            sourceMapGenerator.mergeMapSection(totalPrefixLines, 0, sourceMapString,
                new ExtensionMergeAction() {
                  @Override
                  public Object merge(String extKey, Object oldVal, Object newVal) {
                    return newVal;
                  }
                });
            StringWriter stringWriter = new StringWriter();
            sourceMapGenerator.appendTo(stringWriter, "sourceMap");
            emArt = emitSourceMapString(logger, stringWriter.toString(), partialPath);
          } catch (Exception e) {
            logger.log(TreeLogger.Type.WARN, "Can't write source map " + partialPath, e);
          }
        }
View Full Code Here

  protected List<SyntheticArtifact> recordSourceMap(List<JsSourceMap> sourceInfoMaps)
      throws IOException, JSONException, SourceMapParseException {
    List<SyntheticArtifact> toReturn = Lists.newArrayList();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    SourceMapGeneratorV3 generator = new SourceMapGeneratorV3();
    int fragment = 0;
    if (!sourceInfoMaps.isEmpty()) {
      for (JsSourceMap sourceMap : sourceInfoMaps) {
        generator.reset();
        addMappings(new SourceMappingWriter(generator), sourceMap);
        updateSourceMap(generator, fragment);

        baos.reset();
        OutputStreamWriter out = new OutputStreamWriter(baos);
        generator.appendTo(out, "sourceMap" + fragment);
        out.flush();
        toReturn.add(new SymbolMapsLinker.SourceMapArtifact(permutationId, fragment,
            baos.toByteArray()));
        fragment++;
      }
View Full Code Here

        SyntheticArtifact emArt = null;
        // no need to adjust source map
        if (editArtifact == null) {
          emArt = emitSourceMapString(logger, sourceMapString, partialPath);
        } else {
          SourceMapGeneratorV3 sourceMapGenerator = new SourceMapGeneratorV3();
          try {
            int totalPrefixLines = 0;
            for (ScriptFragmentEditsArtifact.EditOperation op : editArtifact.editOperations) {
              if (op.getOp() == ScriptFragmentEditsArtifact.Edit.PREFIX) {
                totalPrefixLines += op.getNumLines();
              }
            }
            // TODO(cromwellian): apply insert and remove edits
            sourceMapGenerator.mergeMapSection(totalPrefixLines, 0, sourceMapString,
                new ExtensionMergeAction() {
                  @Override
                  public Object merge(String extKey, Object oldVal, Object newVal) {
                    return newVal;
                  }
                });
            StringWriter stringWriter = new StringWriter();
            sourceMapGenerator.appendTo(stringWriter, "sourceMap");
            emArt = emitSourceMapString(logger, stringWriter.toString(), partialPath);
          } catch (Exception e) {
            logger.log(TreeLogger.Type.WARN, "Can't write source map " + partialPath, e);
          }
        }
View Full Code Here

                totalPrefixLines += op.getNumLines();
              }
            }
            // TODO(cromwellian): apply insert and remove edits
            sourceMapGenerator.mergeMapSection(totalPrefixLines, 0, sourceMapString,
                new ExtensionMergeAction() {
                  @Override
                  public Object merge(String extKey, Object oldVal, Object newVal) {
                    return newVal;
                  }
                });
View Full Code Here

                totalPrefixLines += op.getNumLines();
              }
            }
            // TODO(cromwellian): apply insert and remove edits
            sourceMapGenerator.mergeMapSection(totalPrefixLines, 0, sourceMapString,
                new ExtensionMergeAction() {
                  @Override
                  public Object merge(String extKey, Object oldVal, Object newVal) {
                    return newVal;
                  }
                });
View Full Code Here

TOP

Related Classes of com.google.gwt.thirdparty.debugging.sourcemap.SourceMapGeneratorV3.ExtensionMergeAction

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.