Fix transforming of coroutine's create when it is suspend lambda with receiver

Unlike ordinary lambdas suspend lambdas has create method which invokes
the constructor of the lambda object (continuation).
The inliner could not cope with this.
The previous change fixed the case of suspend lambda without receiver.
This change adds support of suspend lambdas with receiver.

 #KT-21605: Fixed
This commit is contained in:
Ilmir Usmanov
2018-03-23 19:57:20 +03:00
parent e96b5f3117
commit 58bac6882d
6 changed files with 59 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
@@ -291,7 +291,7 @@ class MethodInliner(
}
val isContinuationCreate = isContinuation && oldInfo != null && resultNode.name == "create" &&
resultNode.desc.startsWith("(" + CONTINUATION_ASM_TYPE.descriptor)
resultNode.desc.endsWith(")" + CONTINUATION_ASM_TYPE.descriptor)
for (capturedParamDesc in info.allRecapturedParameters) {
if (capturedParamDesc.fieldName == THIS && isContinuationCreate) {