[JVM IR] Fix lineNumber passing into CoroutineTransformer.
- Get it from `IrFile` & `IrElement.startOffset` instead of descriptor - Unmute stepping tests
This commit is contained in:
+16
-1
@@ -49,11 +49,26 @@ internal fun MethodNode.acceptWithStateMachine(
|
|||||||
irFunction.psiElement ?: classCodegen.irClass.psiElement
|
irFunction.psiElement ?: classCodegen.irClass.psiElement
|
||||||
else
|
else
|
||||||
classCodegen.context.suspendLambdaToOriginalFunctionMap[classCodegen.irClass.attributeOwnerId]!!.psiElement
|
classCodegen.context.suspendLambdaToOriginalFunctionMap[classCodegen.irClass.attributeOwnerId]!!.psiElement
|
||||||
|
|
||||||
|
val lineNumber = if (irFunction.isSuspend) {
|
||||||
|
val irFile = irFunction.file
|
||||||
|
if (irFunction.startOffset >= 0) {
|
||||||
|
// if it suspend function like `suspend fun foo(...)`
|
||||||
|
irFile.fileEntry.getLineNumber(irFunction.startOffset)
|
||||||
|
} else {
|
||||||
|
val klass = classCodegen.irClass
|
||||||
|
if (klass.startOffset >= 0) {
|
||||||
|
// if it suspend lambda transformed into class `runSuspend { .... }`
|
||||||
|
irFile.fileEntry.getLineNumber(klass.startOffset)
|
||||||
|
} else 0
|
||||||
|
}
|
||||||
|
} else element?.let { CodegenUtil.getLineNumberForElement(it, false) } ?: 0
|
||||||
|
|
||||||
val visitor = CoroutineTransformerMethodVisitor(
|
val visitor = CoroutineTransformerMethodVisitor(
|
||||||
methodVisitor, access, name, desc, signature, exceptions.toTypedArray(),
|
methodVisitor, access, name, desc, signature, exceptions.toTypedArray(),
|
||||||
obtainClassBuilderForCoroutineState = obtainContinuationClassBuilder,
|
obtainClassBuilderForCoroutineState = obtainContinuationClassBuilder,
|
||||||
reportSuspensionPointInsideMonitor = { reportSuspensionPointInsideMonitor(element as KtElement, state, it) },
|
reportSuspensionPointInsideMonitor = { reportSuspensionPointInsideMonitor(element as KtElement, state, it) },
|
||||||
lineNumber = element?.let { CodegenUtil.getLineNumberForElement(it, false) } ?: 0,
|
lineNumber = lineNumber,
|
||||||
sourceFile = classCodegen.irClass.file.name,
|
sourceFile = classCodegen.irClass.file.name,
|
||||||
languageVersionSettings = languageVersionSettings,
|
languageVersionSettings = languageVersionSettings,
|
||||||
shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization,
|
shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization,
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
LineBreakpoint created at siSuspendFun.kt:31
|
LineBreakpoint created at siSuspendFun.kt:31
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
LineBreakpoint created at souSuspendFun.kt:9
|
LineBreakpoint created at souSuspendFun.kt:9
|
||||||
Run Java
|
Run Java
|
||||||
Connected to the target VM
|
Connected to the target VM
|
||||||
|
|||||||
Reference in New Issue
Block a user