All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
.kotlin.kotlin-compiler.1.3.11.source-code.IrLazyTypeParameter.kt Maven / Gradle / Ivy
/*
* Copyright 2010-2018 JetBrains s.r.o. 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.TypeParameterDescriptor
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
import org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
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.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.Variance
class IrLazyTypeParameter(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val symbol: IrTypeParameterSymbol,
override val name: Name,
override val index: Int,
override val isReified: Boolean,
override val variance: Variance,
stubGenerator: DeclarationStubGenerator,
typeTranslator: TypeTranslator
) :
IrLazyDeclarationBase(startOffset, endOffset, origin, stubGenerator, typeTranslator),
IrTypeParameter {
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
symbol: IrTypeParameterSymbol,
stubGenerator: DeclarationStubGenerator,
TypeTranslator: TypeTranslator
) :
this(
startOffset, endOffset, origin, symbol,
symbol.descriptor.name,
symbol.descriptor.index,
symbol.descriptor.isReified,
symbol.descriptor.variance,
stubGenerator, TypeTranslator
)
override val descriptor: TypeParameterDescriptor get() = symbol.descriptor
init {
symbol.bind(this)
}
override val superTypes: MutableList by lazy {
typeTranslator.buildWithScope(this.parent as IrTypeParametersContainer) {
val descriptor = symbol.descriptor
descriptor.upperBounds.mapTo(arrayListOf()) { it.toIrType() }
}
}
override fun accept(visitor: IrElementVisitor, data: D): R =
visitor.visitTypeParameter(this, data)
override fun transform(transformer: IrElementTransformer, data: D): IrTypeParameter =
transformer.visitTypeParameter(this, data) as IrTypeParameter
override fun acceptChildren(visitor: IrElementVisitor, data: D) {
// no children
}
override fun transformChildren(transformer: IrElementTransformer, data: D) {
// no children
}
}