[Sourcemap] Add an ability to provide outputColumn to SourceMap3Builder#addMapping instead of using getCurrentOutputColumn
The ability will be used later by wasm backend while generating sourcemap.
This commit is contained in:
committed by
Space Team
parent
fb4dcc6a6a
commit
54c00cc588
@@ -125,6 +125,18 @@ class SourceMap3Builder(
|
|||||||
sourceLine: Int,
|
sourceLine: Int,
|
||||||
sourceColumn: Int,
|
sourceColumn: Int,
|
||||||
name: String?,
|
name: String?,
|
||||||
|
) {
|
||||||
|
addMapping(source, fileIdentity, sourceContent, sourceLine, sourceColumn, name, getCurrentOutputColumn())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addMapping(
|
||||||
|
source: String,
|
||||||
|
fileIdentity: Any?,
|
||||||
|
sourceContent: Supplier<Reader?>,
|
||||||
|
sourceLine: Int,
|
||||||
|
sourceColumn: Int,
|
||||||
|
name: String?,
|
||||||
|
outputColumn: Int
|
||||||
) {
|
) {
|
||||||
val sourceIndex = getSourceIndex(source.replace(File.separatorChar, '/'), fileIdentity, sourceContent)
|
val sourceIndex = getSourceIndex(source.replace(File.separatorChar, '/'), fileIdentity, sourceContent)
|
||||||
|
|
||||||
@@ -138,7 +150,7 @@ class SourceMap3Builder(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
startMapping()
|
startMapping(outputColumn)
|
||||||
|
|
||||||
Base64VLQ.encode(out, sourceIndex - previousSourceIndex)
|
Base64VLQ.encode(out, sourceIndex - previousSourceIndex)
|
||||||
previousSourceIndex = sourceIndex
|
previousSourceIndex = sourceIndex
|
||||||
@@ -159,19 +171,17 @@ class SourceMap3Builder(
|
|||||||
|
|
||||||
override fun addEmptyMapping() {
|
override fun addEmptyMapping() {
|
||||||
if (!currentMappingIsEmpty) {
|
if (!currentMappingIsEmpty) {
|
||||||
startMapping()
|
startMapping(getCurrentOutputColumn())
|
||||||
currentMappingIsEmpty = true
|
currentMappingIsEmpty = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startMapping() {
|
private fun startMapping(column: Int) {
|
||||||
val newGroupStarted = previousGeneratedColumn == -1
|
val newGroupStarted = previousGeneratedColumn == -1
|
||||||
if (newGroupStarted) {
|
if (newGroupStarted) {
|
||||||
previousGeneratedColumn = 0
|
previousGeneratedColumn = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
val column = getCurrentOutputColumn()
|
|
||||||
|
|
||||||
val columnDiff = column - previousGeneratedColumn
|
val columnDiff = column - previousGeneratedColumn
|
||||||
if (!newGroupStarted) {
|
if (!newGroupStarted) {
|
||||||
out.append(',')
|
out.append(',')
|
||||||
|
|||||||
Reference in New Issue
Block a user