コード例 #1
0
        public void writeEntry(SourceMapEntry entry, SourceFile targetFile, StringBuffer output)
        {
            int targetLine   = targetFile.getLine(entry.targetOffset);
            int targetColumn = targetFile.getColumn(targetLine, entry.targetOffset);

            if (targetLine > previousTargetLine)
            {
                for (int i = previousTargetLine; i < targetLine; ++i)
                {
                    output.write(";");
                }
                previousTargetLine   = targetLine;
                previousTargetColumn = 0;
                firstEntryInLine     = true;
            }

            if (!firstEntryInLine)
            {
                output.write(",");
            }
            firstEntryInLine = false;

            encodeVLQ(output, targetColumn - previousTargetColumn);
            previousTargetColumn = targetColumn;

            if (entry.sourceLocation == null)
            {
                return;
            }

            String sourceUrl    = entry.sourceLocation.getSourceUrl();
            int    sourceLine   = entry.sourceLocation.getLine();
            int    sourceColumn = entry.sourceLocation.getColumn();
            String sourceName   = entry.sourceLocation.getSourceName();

            int sourceUrlIndex = indexOf(sourceUrlList, sourceUrl, sourceUrlMap);

            encodeVLQ(output, sourceUrlIndex - previousSourceUrlIndex);
            encodeVLQ(output, sourceLine - previousSourceLine);
            encodeVLQ(output, sourceColumn - previousSourceColumn);

            if (sourceName != null)
            {
                int sourceNameIndex = indexOf(sourceNameList, sourceName, sourceNameMap);
                encodeVLQ(output, sourceNameIndex - previousSourceNameIndex);
            }

            // Update previous source location to ensure the next indices are relative
            // to those if [entry.sourceLocation].
            updatePreviousSourceLocation(entry.sourceLocation);
        }
コード例 #2
0
      public void writeEntry(SourceMapEntry entry, SourceFile targetFile, StringBuffer output) 
      {
         int targetLine = targetFile.getLine(entry.targetOffset);
         int targetColumn = targetFile.getColumn(targetLine, entry.targetOffset);

         if (targetLine > previousTargetLine) {
            for (int i = previousTargetLine; i < targetLine; ++i) {
               output.write(";");
            }
            previousTargetLine = targetLine;
            previousTargetColumn = 0;
            firstEntryInLine = true;
         }

         if (!firstEntryInLine) {
            output.write(",");
         }
         firstEntryInLine = false;

         encodeVLQ(output, targetColumn - previousTargetColumn);
         previousTargetColumn = targetColumn;

         if (entry.sourceLocation == null) return;

         String sourceUrl = entry.sourceLocation.getSourceUrl();
         int sourceLine = entry.sourceLocation.getLine();
         int sourceColumn = entry.sourceLocation.getColumn();
         String sourceName = entry.sourceLocation.getSourceName();

         int sourceUrlIndex = indexOf(sourceUrlList, sourceUrl, sourceUrlMap);
         encodeVLQ(output, sourceUrlIndex - previousSourceUrlIndex);
         encodeVLQ(output, sourceLine - previousSourceLine);
         encodeVLQ(output, sourceColumn - previousSourceColumn);

         if (sourceName != null) {
            int sourceNameIndex = indexOf(sourceNameList, sourceName, sourceNameMap);
            encodeVLQ(output, sourceNameIndex - previousSourceNameIndex);
         }

         // Update previous source location to ensure the next indices are relative
         // to those if [entry.sourceLocation].
         updatePreviousSourceLocation(entry.sourceLocation);
      }
コード例 #3
0
 public int getColumn()
 {
     return(sourceFile.getColumn(getLine(), offset));
 }