From 7c172f57981ff40696450c3da9688ea89ed470f6 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 27 Jan 2022 13:49:59 +0100 Subject: [PATCH] IR: minor, extract IrLazyValueParameter to a separate file --- .../ir/declarations/lazy/IrLazyConstructor.kt | 33 ------------- .../declarations/lazy/IrLazyValueParameter.kt | 48 +++++++++++++++++++ 2 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyValueParameter.kt diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyConstructor.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyConstructor.kt index 04e74b981be..c5ca5a07cfe 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyConstructor.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyConstructor.kt @@ -7,15 +7,11 @@ package org.jetbrains.kotlin.ir.declarations.lazy import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor import org.jetbrains.kotlin.descriptors.DescriptorVisibility -import org.jetbrains.kotlin.descriptors.ParameterDescriptor -import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrBody import org.jetbrains.kotlin.ir.expressions.IrConstructorCall -import org.jetbrains.kotlin.ir.expressions.IrExpressionBody import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol -import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator import org.jetbrains.kotlin.ir.util.TypeTranslator @@ -24,35 +20,6 @@ import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource -@OptIn(ObsoleteDescriptorBasedAPI::class) -class IrLazyValueParameter( - override val startOffset: Int, - override val endOffset: Int, - override var origin: IrDeclarationOrigin, - override val symbol: IrValueParameterSymbol, - override val descriptor: ValueParameterDescriptor, - override val name: Name, - override val index: Int, - override var type: IrType, - override var varargElementType: IrType?, - override val isCrossinline: Boolean, - override val isNoinline: Boolean, - override val isHidden: Boolean, - override val isAssignable: Boolean, - override val stubGenerator: DeclarationStubGenerator, - override val typeTranslator: TypeTranslator, -) : IrValueParameter(), IrLazyDeclarationBase { - override lateinit var parent: IrDeclarationParent - - override var defaultValue: IrExpressionBody? = null - - override var annotations: List by createLazyAnnotations() - - init { - symbol.bind(this) - } -} - @OptIn(ObsoleteDescriptorBasedAPI::class) class IrLazyConstructor( override val startOffset: Int, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyValueParameter.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyValueParameter.kt new file mode 100644 index 00000000000..f094fd53974 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/lazy/IrLazyValueParameter.kt @@ -0,0 +1,48 @@ +/* + * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ir.declarations.lazy + +import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent +import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.expressions.IrConstructorCall +import org.jetbrains.kotlin.ir.expressions.IrExpressionBody +import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator +import org.jetbrains.kotlin.ir.util.TypeTranslator +import org.jetbrains.kotlin.name.Name + +@OptIn(ObsoleteDescriptorBasedAPI::class) +class IrLazyValueParameter( + override val startOffset: Int, + override val endOffset: Int, + override var origin: IrDeclarationOrigin, + override val symbol: IrValueParameterSymbol, + override val descriptor: ValueParameterDescriptor, + override val name: Name, + override val index: Int, + override var type: IrType, + override var varargElementType: IrType?, + override val isCrossinline: Boolean, + override val isNoinline: Boolean, + override val isHidden: Boolean, + override val isAssignable: Boolean, + override val stubGenerator: DeclarationStubGenerator, + override val typeTranslator: TypeTranslator, +) : IrValueParameter(), IrLazyDeclarationBase { + override lateinit var parent: IrDeclarationParent + + override var defaultValue: IrExpressionBody? = null + + override var annotations: List by createLazyAnnotations() + + init { + symbol.bind(this) + } +}