mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
Generate decomposed lambda params in suspend lambda's local variables
Unlike ordinary lambdas, suspend lambdas do the computation in doResume(Ljava/lang/Object;Ljava/lang/Throwable;)Ljava/lang/Object; method. As you can see, there are no decomposed parameters. As a result, they used not to be generated. To fix the issue, I add decomposed parameters to value parameters while generating local variables table. In addition, when generating suspend lambda for inline, the codegen does not take this kind of parameters into account. This is also fixed. #KT-18576: Fixed
This commit is contained in:
10
compiler/testData/codegen/bytecodeText/coroutines/destructuringInLambda/inlineSeparateFiles.kt
vendored
Normal file
10
compiler/testData/codegen/bytecodeText/coroutines/destructuringInLambda/inlineSeparateFiles.kt
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
data class A(val x: String, val y: String)
|
||||
|
||||
suspend inline fun foo(a: A, block: suspend (A) -> String): String = block(a)
|
||||
|
||||
// FILE: test.kt
|
||||
suspend fun test() = foo(A("O", "K")) { (x_param, y_param) -> x_param + y_param }
|
||||
|
||||
// @TestKt.class:
|
||||
// 1 LOCALVARIABLE x_param Ljava/lang/String;
|
||||
// 1 LOCALVARIABLE y_param Ljava/lang/String;
|
||||
Reference in New Issue
Block a user