Allow destructuring in suspend lambda with suspend componentX

#KT-16113 Fixed
This commit is contained in:
Denis Zharkov
2017-02-02 10:58:29 +03:00
parent 59fe7444d1
commit 60c2579436
12 changed files with 132 additions and 8 deletions
@@ -80,6 +80,7 @@ enum class LexicalScopeKind(val withLocalDescriptors: Boolean) {
PROPERTY_DELEGATE_METHOD(false),
FUNCTION_HEADER(false),
FUNCTION_HEADER_FOR_DESTRUCTURING(false),
FUNCTION_INNER_SCOPE(true),
TYPE_ALIAS_HEADER(false),
@@ -201,9 +201,12 @@ fun LexicalScope.replaceImportingScopes(importingScopeChain: ImportingScope?): L
return LexicalScopeWrapper(this, newImportingScopeChain)
}
fun LexicalScope.addImplicitReceiver(newReceiver: ReceiverParameterDescriptor?): LexicalScope {
if (newReceiver == null) return this
return LexicalScopeImpl(parent, ownerDescriptor, isOwnerDescriptorAccessibleByLabel, newReceiver, kind)
fun LexicalScope.createScopeForDestructuring(newReceiver: ReceiverParameterDescriptor?): LexicalScope {
return LexicalScopeImpl(
parent, ownerDescriptor, isOwnerDescriptorAccessibleByLabel,
newReceiver ?: implicitReceiver,
LexicalScopeKind.FUNCTION_HEADER_FOR_DESTRUCTURING
)
}
private class LexicalScopeWrapper(val delegate: LexicalScope, val newImportingScopeChain: ImportingScope): LexicalScope by delegate {