From f0e4420259dec1ca0efb906edc16801d3988bc04 Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Thu, 3 May 2018 11:01:10 +0200 Subject: [PATCH] Don't recreate ir declarations to set body --- .../lower/DefaultArgumentStubGenerator.kt | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt index 96370644a07..145ef658a6f 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt @@ -161,20 +161,9 @@ open class DefaultArgumentStubGenerator constructor(val context: CommonBackendCo irFunction.valueParameters.forEach { it.defaultValue = null } - return if (functionDescriptor is ClassConstructorDescriptor) - listOf(irFunction, IrConstructorImpl( - startOffset = irFunction.startOffset, - endOffset = irFunction.endOffset, - descriptor = descriptor as ClassConstructorDescriptor, - origin = DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER, - body = body).apply { createParameterDeclarations() }) - else - listOf(irFunction, IrFunctionImpl( - startOffset = irFunction.startOffset, - endOffset = irFunction.endOffset, - descriptor = descriptor, - origin = DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER, - body = body).apply { createParameterDeclarations() }) + + newIrFunction.body = body + return listOf(irFunction, newIrFunction) } return listOf(irFunction) }