IR: remove deprecated constructor of IrTypeParameterImpl

This commit is contained in:
Alexander Udalov
2020-07-06 22:32:01 +02:00
parent 0691595ed2
commit fd83596c91
3 changed files with 14 additions and 18 deletions
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
import org.jetbrains.kotlin.ir.declarations.impl.carriers.TypeParameterCarrier import org.jetbrains.kotlin.ir.declarations.impl.carriers.TypeParameterCarrier
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -44,19 +43,6 @@ class IrTypeParameterImpl(
IrTypeParameter, IrTypeParameter,
TypeParameterCarrier { TypeParameterCarrier {
@Deprecated("Use constructor which takes symbol instead of descriptor")
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: TypeParameterDescriptor,
name: Name = descriptor.name,
symbol: IrTypeParameterSymbol = IrTypeParameterSymbolImpl(descriptor)
) : this(
startOffset, endOffset, origin, symbol, name,
index = descriptor.index, isReified = descriptor.isReified, variance = descriptor.variance
)
init { init {
symbol.bind(this) symbol.bind(this)
} }
@@ -79,4 +65,4 @@ class IrTypeParameterImpl(
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) { override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
// no children // no children
} }
} }
@@ -826,13 +826,17 @@ open class SymbolTable(
return IrTypeParameterSymbolImpl(descriptor) return IrTypeParameterSymbolImpl(descriptor)
} }
@OptIn(ObsoleteDescriptorBasedAPI::class)
fun declareGlobalTypeParameter( fun declareGlobalTypeParameter(
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
origin: IrDeclarationOrigin, origin: IrDeclarationOrigin,
descriptor: TypeParameterDescriptor, descriptor: TypeParameterDescriptor,
typeParameterFactory: (IrTypeParameterSymbol) -> IrTypeParameter = { typeParameterFactory: (IrTypeParameterSymbol) -> IrTypeParameter = {
IrTypeParameterImpl(startOffset, endOffset, origin, descriptor, nameProvider.nameForDeclaration(descriptor), it) IrTypeParameterImpl(
startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor),
it.descriptor.index, it.descriptor.isReified, it.descriptor.variance
)
} }
): IrTypeParameter = ): IrTypeParameter =
globalTypeParameterSymbolTable.declare( globalTypeParameterSymbolTable.declare(
@@ -850,13 +854,17 @@ open class SymbolTable(
return globalTypeParameterSymbolTable.declare(descriptor, { IrTypeParameterSymbolImpl(descriptor) }, typeParameterFactory) return globalTypeParameterSymbolTable.declare(descriptor, { IrTypeParameterSymbolImpl(descriptor) }, typeParameterFactory)
} }
@OptIn(ObsoleteDescriptorBasedAPI::class)
fun declareScopedTypeParameter( fun declareScopedTypeParameter(
startOffset: Int, startOffset: Int,
endOffset: Int, endOffset: Int,
origin: IrDeclarationOrigin, origin: IrDeclarationOrigin,
descriptor: TypeParameterDescriptor, descriptor: TypeParameterDescriptor,
typeParameterFactory: (IrTypeParameterSymbol) -> IrTypeParameter = { typeParameterFactory: (IrTypeParameterSymbol) -> IrTypeParameter = {
IrTypeParameterImpl(startOffset, endOffset, origin, descriptor, nameProvider.nameForDeclaration(descriptor), it) IrTypeParameterImpl(
startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor),
it.descriptor.index, it.descriptor.isReified, it.descriptor.variance
)
} }
): IrTypeParameter = ): IrTypeParameter =
scopedTypeParameterSymbolTable.declare( scopedTypeParameterSymbolTable.declare(
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.ir.declarations.impl.*
import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
@@ -407,7 +408,8 @@ interface IrBuilderExtension {
IrTypeParameterImpl( IrTypeParameterImpl(
startOffset, endOffset, startOffset, endOffset,
SERIALIZABLE_PLUGIN_ORIGIN, SERIALIZABLE_PLUGIN_ORIGIN,
it IrTypeParameterSymbolImpl(it),
it.name, it.index, it.isReified, it.variance
).also { typeParameter -> ).also { typeParameter ->
typeParameter.parent = this typeParameter.parent = this
} }