JVM_IR: Generate as much LINENUMBER information as possible inside
suspend functions and lambdas. Otherwise, when state-machine builder splits instructions and adds LINENUMBER between states, the information becomes corrupted.
This commit is contained in:
+4
-1
@@ -149,7 +149,10 @@ class ExpressionCodegen(
|
||||
if (fileEntry != null) {
|
||||
val lineNumber = fileEntry.getLineNumber(offset) + 1
|
||||
assert(lineNumber > 0)
|
||||
if (lastLineNumber != lineNumber) {
|
||||
// State-machine builder splits the sequence of instructions into states inside state-machine, adding additional LINENUMBERs
|
||||
// between them for debugger to stop on suspension. Thus, it requires as much LINENUMBER information as possible to be present,
|
||||
// otherwise, any exception will have incorrect line number. See elvisLineNumber.kt test.
|
||||
if (lastLineNumber != lineNumber || irFunction.isSuspend || irFunction.isInvokeSuspendOfLambda(context)) {
|
||||
lastLineNumber = lineNumber
|
||||
mv.visitLineNumber(lineNumber, markNewLabel())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user