[K/Wasm] Reduce debug information for the internal Kotlin functions
This commit is contained in:
@@ -11,6 +11,8 @@ sealed class SourceLocation {
|
||||
// Both line and column are zero-based
|
||||
data class Location(val file: String, val line: Int, val column: Int) : SourceLocation()
|
||||
|
||||
data class IgnoredLocation(val file: String, val line: Int, val column: Int) : SourceLocation()
|
||||
|
||||
companion object {
|
||||
@Suppress("FunctionName", "UNUSED_PARAMETER")
|
||||
fun NoLocation(description: String): SourceLocation = NoLocation
|
||||
|
||||
@@ -131,7 +131,8 @@ class WasmDebugRunner(testServices: TestServices) : AbstractWasmArtifactsCollect
|
||||
toolArgs = listOf("--enable-inspector", "--allow-natives-syntax")
|
||||
)
|
||||
val debuggerSteps = FrameParser(result).parse().mapNotNull { frame ->
|
||||
val pausedLocation = sourceMap.segmentForGeneratedLocation(frame.pausedLocation.line, frame.pausedLocation.column)
|
||||
val pausedLocation = sourceMap
|
||||
.findSegmentForTheGeneratedLocation(frame.pausedLocation.line, frame.pausedLocation.column)
|
||||
?.takeIf { it.sourceLineNumber >= 0 }
|
||||
|
||||
pausedLocation?.sourceFileName?.let { sourceFileName ->
|
||||
@@ -179,6 +180,14 @@ class WasmDebugRunner(testServices: TestServices) : AbstractWasmArtifactsCollect
|
||||
writeToFilesAndRunTest("dce", artifacts.compilerResultWithDCE)
|
||||
}
|
||||
|
||||
private fun SourceMap.findSegmentForTheGeneratedLocation(lineNumber: Int, columnNumber: Int): SourceMapSegment? {
|
||||
val group = groups.getOrNull(lineNumber)?.takeIf { it.segments.isNotEmpty() } ?: return null
|
||||
return group.segments
|
||||
.indexOfLast { columnNumber >= it.generatedColumnNumber }
|
||||
.takeIf { it >= 0 }
|
||||
?.let(group.segments::get)
|
||||
}
|
||||
|
||||
private val WasmCompilerResult.parsedSourceMaps: SourceMap
|
||||
get() = when (val parseResult = SourceMapParser.parse(debugInformation?.sourceMapForBinary ?: error("Expect to have source maps for stepping test"))) {
|
||||
is SourceMapSuccess -> parseResult.value
|
||||
|
||||
Reference in New Issue
Block a user