[IR] Unbind construction methods of IrValueParameterImpl from symbol.descriptor
This commit is contained in:
+29
-18
@@ -35,17 +35,22 @@ class IrValueParameterImpl(
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrValueParameterSymbol,
|
||||
override val name: Name = symbol.descriptor.name,
|
||||
override val index: Int = symbol.descriptor.safeAs<ValueParameterDescriptor>()?.index ?: -1,
|
||||
override val name: Name,
|
||||
override val index: Int,
|
||||
override val type: IrType,
|
||||
override val varargElementType: IrType?,
|
||||
override val isCrossinline: Boolean = symbol.descriptor.safeAs<ValueParameterDescriptor>()?.isCrossinline ?: false,
|
||||
override val isNoinline: Boolean = symbol.descriptor.safeAs<ValueParameterDescriptor>()?.isNoinline ?: false
|
||||
override val isCrossinline: Boolean,
|
||||
override val isNoinline: Boolean
|
||||
) :
|
||||
IrDeclarationBase<ValueParameterCarrier>(startOffset, endOffset, origin),
|
||||
IrValueParameter,
|
||||
ValueParameterCarrier {
|
||||
|
||||
@Deprecated(
|
||||
"This constructor is left for native compilation purpose only. " +
|
||||
"It takes value parameter attributes from symbol.descriptor " +
|
||||
"Please either provide parameter attributes or its descriptor explicitly"
|
||||
)
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
@@ -53,17 +58,15 @@ class IrValueParameterImpl(
|
||||
symbol: IrValueParameterSymbol,
|
||||
type: IrType,
|
||||
varargElementType: IrType?
|
||||
) :
|
||||
this(
|
||||
startOffset, endOffset, origin,
|
||||
symbol,
|
||||
symbol.descriptor.name,
|
||||
symbol.descriptor.safeAs<ValueParameterDescriptor>()?.index ?: -1,
|
||||
type,
|
||||
varargElementType,
|
||||
symbol.descriptor.safeAs<ValueParameterDescriptor>()?.isCrossinline ?: false,
|
||||
symbol.descriptor.safeAs<ValueParameterDescriptor>()?.isNoinline ?: false
|
||||
)
|
||||
) : this(
|
||||
startOffset, endOffset, origin, symbol,
|
||||
name = symbol.descriptor.name,
|
||||
index = symbol.descriptor.safeAs<ValueParameterDescriptor>()?.index ?: -1,
|
||||
type = type,
|
||||
varargElementType = varargElementType,
|
||||
isCrossinline = symbol.descriptor.safeAs<ValueParameterDescriptor>()?.isCrossinline == true,
|
||||
isNoinline = symbol.descriptor.safeAs<ValueParameterDescriptor>()?.isNoinline == true
|
||||
)
|
||||
|
||||
constructor(
|
||||
startOffset: Int,
|
||||
@@ -71,9 +74,17 @@ class IrValueParameterImpl(
|
||||
origin: IrDeclarationOrigin,
|
||||
descriptor: ParameterDescriptor,
|
||||
type: IrType,
|
||||
varargElementType: IrType?
|
||||
) :
|
||||
this(startOffset, endOffset, origin, IrValueParameterSymbolImpl(descriptor), type, varargElementType)
|
||||
varargElementType: IrType?,
|
||||
name: Name = descriptor.name,
|
||||
symbol: IrValueParameterSymbol = IrValueParameterSymbolImpl(descriptor)
|
||||
) : this(
|
||||
startOffset, endOffset, origin, symbol,
|
||||
name,
|
||||
index = descriptor.safeAs<ValueParameterDescriptor>()?.index ?: -1,
|
||||
type = type, varargElementType = varargElementType,
|
||||
isCrossinline = descriptor.safeAs<ValueParameterDescriptor>()?.isCrossinline ?: false,
|
||||
isNoinline = descriptor.safeAs<ValueParameterDescriptor>()?.isNoinline ?: false
|
||||
)
|
||||
|
||||
override val descriptor: ParameterDescriptor = symbol.descriptor
|
||||
|
||||
|
||||
@@ -357,9 +357,11 @@ class IrFunctionFactory(private val irBuiltIns: IrBuiltIns, private val symbolTa
|
||||
offset,
|
||||
offset,
|
||||
memberOrigin,
|
||||
symbol,
|
||||
toIrType(descriptor.type),
|
||||
varargType?.let { toIrType(it) }).also {
|
||||
descriptor,
|
||||
symbol = symbol,
|
||||
type = toIrType(descriptor.type),
|
||||
varargElementType = varargType?.let { toIrType(it) }
|
||||
).also {
|
||||
it.parent = this
|
||||
}
|
||||
}
|
||||
|
||||
@@ -800,9 +800,10 @@ open class SymbolTable(
|
||||
varargElementType: IrType? = null,
|
||||
valueParameterFactory: (IrValueParameterSymbol) -> IrValueParameter = {
|
||||
IrValueParameterImpl(
|
||||
startOffset, endOffset, origin, it,
|
||||
nameProvider.nameForDeclaration(descriptor),
|
||||
startOffset, endOffset, origin, descriptor,
|
||||
name = nameProvider.nameForDeclaration(descriptor),
|
||||
type = type, varargElementType = varargElementType,
|
||||
symbol = it
|
||||
)
|
||||
}
|
||||
): IrValueParameter =
|
||||
|
||||
Reference in New Issue
Block a user