org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl.kt Maven / Gradle / Ivy
/*
* 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.impl
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
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.symbols.IrConstructorSymbol
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
import org.jetbrains.kotlin.ir.types.impl.ReturnTypeIsNotInitializedException
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
class IrConstructorImpl(
override val startOffset: Int,
override val endOffset: Int,
override var origin: IrDeclarationOrigin,
override val symbol: IrConstructorSymbol,
override var name: Name,
override var visibility: DescriptorVisibility,
returnType: IrType,
override val isInline: Boolean,
override val isExternal: Boolean,
override val isPrimary: Boolean,
override val isExpect: Boolean,
override val containerSource: DeserializedContainerSource? = null,
override val factory: IrFactory = IrFactoryImpl,
) : IrConstructor() {
init {
symbol.bind(this)
}
override lateinit var parent: IrDeclarationParent
override var annotations: List = emptyList()
override var returnType: IrType = returnType
get() = if (field === IrUninitializedType) {
throw ReturnTypeIsNotInitializedException(this)
} else {
field
}
override var typeParameters: List = emptyList()
override var dispatchReceiverParameter: IrValueParameter? = null
override var extensionReceiverParameter: IrValueParameter? = null
override var contextReceiverParametersCount: Int = 0
override var valueParameters: List = emptyList()
override var body: IrBody? = null
override var metadata: MetadataSource? = null
@ObsoleteDescriptorBasedAPI
override val descriptor: ClassConstructorDescriptor
get() = symbol.descriptor
}