[JVM_IR] Fix off-by-one line number error in CoroutineCodegen.

Fixes KT-41957.
This commit is contained in:
Mads Ager
2020-10-13 11:38:32 +02:00
committed by Alexander Udalov
parent 13def12731
commit 17748b4499
2 changed files with 2 additions and 3 deletions
@@ -55,12 +55,12 @@ internal fun MethodNode.acceptWithStateMachine(
val irFile = irFunction.file
if (irFunction.startOffset >= 0) {
// if it suspend function like `suspend fun foo(...)`
irFile.fileEntry.getLineNumber(irFunction.startOffset)
irFile.fileEntry.getLineNumber(irFunction.startOffset) + 1
} else {
val klass = classCodegen.irClass
if (klass.startOffset >= 0) {
// if it suspend lambda transformed into class `runSuspend { .... }`
irFile.fileEntry.getLineNumber(klass.startOffset)
irFile.fileEntry.getLineNumber(klass.startOffset) + 1
} else 0
}
} else element?.let { CodegenUtil.getLineNumberForElement(it, false) } ?: 0
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
LineBreakpoint created at stepIntoSuspendFunctionSimple.kt:20
Run Java
Connected to the target VM