mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
[JVM IR] Fix lineNumber passing into CoroutineTransformer.
- Get it from `IrFile` & `IrElement.startOffset` instead of descriptor - Unmute stepping tests
This commit is contained in:
@@ -49,11 +49,26 @@ internal fun MethodNode.acceptWithStateMachine(
|
||||
irFunction.psiElement ?: classCodegen.irClass.psiElement
|
||||
else
|
||||
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(
|
||||
methodVisitor, access, name, desc, signature, exceptions.toTypedArray(),
|
||||
obtainClassBuilderForCoroutineState = obtainContinuationClassBuilder,
|
||||
reportSuspensionPointInsideMonitor = { reportSuspensionPointInsideMonitor(element as KtElement, state, it) },
|
||||
lineNumber = element?.let { CodegenUtil.getLineNumberForElement(it, false) } ?: 0,
|
||||
lineNumber = lineNumber,
|
||||
sourceFile = classCodegen.irClass.file.name,
|
||||
languageVersionSettings = languageVersionSettings,
|
||||
shouldPreserveClassInitialization = state.constructorCallNormalizationMode.shouldPreserveClassInitialization,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
LineBreakpoint created at siSuspendFun.kt:31
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
LineBreakpoint created at souSuspendFun.kt:9
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
|
||||
Reference in New Issue
Block a user