public int getLine() { if (line == -1) { line = sourceFile.getLine(offset); } return(line); }
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); }
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); }
private bool sameLine(int position, int otherPosition) { return(targetFile.getLine(position) == targetFile.getLine(otherPosition)); }