From 1f1de9987867576637d9a976fc51baed63e818e2 Mon Sep 17 00:00:00 2001 From: Konstantin Anisimov Date: Wed, 12 Apr 2017 10:14:46 +0700 Subject: [PATCH] Move call site descriptor substitutor to main algotithm --- .../kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt | 3 --- .../jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt index f63af8e0044..66d4bccd2c3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/common/DeepCopyIrTreeWithDescriptoros.kt @@ -54,10 +54,7 @@ internal class DeepCopyIrTreeWithDescriptors(val targetScope: ScopeWithIr, fun copy(irElement: IrElement, typeSubstitutor: TypeSubstitutor?): IrElement { this.typeSubstitutor = typeSubstitutor - descriptorSubstituteMap.clear() irElement.acceptChildrenVoid(DescriptorCollector()) - // Transform calls to object that might be returned from inline function call. - targetScope.irElement.transformChildrenVoid(descriptorSubstitutorForExternalScope) return irElement.accept(InlineCopyIr(), null) } diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt index 23b73f1b730..29821c4d8c3 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/FunctionInlining.kt @@ -68,7 +68,10 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoidW copyIrElement = DeepCopyIrTreeWithDescriptors(currentScope!!, context) // Create DeepCopy for current scope. functionDeclaration.transformChildrenVoid(this) // Process recursive inline. - return inlineFunction(irCall, functionDeclaration) // Return newly created IrInlineBody instead of IrCall. + val inlineFunctionBody = inlineFunction(irCall, functionDeclaration) // Return newly created IrInlineBody instead of IrCall. + currentScope!!.irElement.transformChildrenVoid( // Transform calls to object that might be returned from inline function call. + copyIrElement!!.descriptorSubstitutorForExternalScope) + return inlineFunctionBody } //-------------------------------------------------------------------------//