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.impl.carriers.TypeParameterCarrier
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.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -44,19 +43,6 @@ class IrTypeParameterImpl(
IrTypeParameter,
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 {
symbol.bind(this)
}
@@ -79,4 +65,4 @@ class IrTypeParameterImpl(
override fun <D> transformChildren(transformer: IrElementTransformer<D>, data: D) {
// no children
}
}
}
@@ -826,13 +826,17 @@ open class SymbolTable(
return IrTypeParameterSymbolImpl(descriptor)
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
fun declareGlobalTypeParameter(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: TypeParameterDescriptor,
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 =
globalTypeParameterSymbolTable.declare(
@@ -850,13 +854,17 @@ open class SymbolTable(
return globalTypeParameterSymbolTable.declare(descriptor, { IrTypeParameterSymbolImpl(descriptor) }, typeParameterFactory)
}
@OptIn(ObsoleteDescriptorBasedAPI::class)
fun declareScopedTypeParameter(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: TypeParameterDescriptor,
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 =
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.impl.*
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.types.*
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
@@ -407,7 +408,8 @@ interface IrBuilderExtension {
IrTypeParameterImpl(
startOffset, endOffset,
SERIALIZABLE_PLUGIN_ORIGIN,
it
IrTypeParameterSymbolImpl(it),
it.name, it.index, it.isReified, it.variance
).also { typeParameter ->
typeParameter.parent = this
}