IR: add type parameter to IrMemberAccessExpression and some subclasses
https://github.com/JetBrains/kotlin/commit/d4605f581657fd01925bfb1d75bd09a0323f3e84 (cherry picked from commit 45893f45601c13d6af2dffae01cf9630f5da374a)
This commit is contained in:
committed by
Vasily Levchenko
parent
e64cf2b6f4
commit
4f87c09451
+1
-1
@@ -101,7 +101,7 @@ private fun KotlinToCCallBuilder.addArgument(
|
|||||||
if (!variadic) cFunctionBuilder.addParameter(cArgument.type)
|
if (!variadic) cFunctionBuilder.addParameter(cArgument.type)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun KotlinToCCallBuilder.buildKotlinBridgeCall(transformCall: (IrMemberAccessExpression) -> IrExpression = { it }): IrExpression =
|
private fun KotlinToCCallBuilder.buildKotlinBridgeCall(transformCall: (IrMemberAccessExpression<*>) -> IrExpression = { it }): IrExpression =
|
||||||
bridgeCallBuilder.build(
|
bridgeCallBuilder.build(
|
||||||
bridgeBuilder.buildKotlinBridge().also {
|
bridgeBuilder.buildKotlinBridge().also {
|
||||||
this.stubs.addKotlin(it)
|
this.stubs.addKotlin(it)
|
||||||
|
|||||||
+1
-1
@@ -186,7 +186,7 @@ internal class KotlinCallBuilder(private val irBuilder: IrBuilderWithScope, priv
|
|||||||
|
|
||||||
fun build(
|
fun build(
|
||||||
function: IrFunction,
|
function: IrFunction,
|
||||||
transformCall: (IrMemberAccessExpression) -> IrExpression = { it }
|
transformCall: (IrMemberAccessExpression<*>) -> IrExpression = { it }
|
||||||
): IrExpression {
|
): IrExpression {
|
||||||
val arguments = this.arguments.toMutableList()
|
val arguments = this.arguments.toMutableList()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -424,7 +424,7 @@ private class InlineClassTransformer(private val context: Context) : IrBuildingT
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun IrBuilderWithScope.lowerConstructorCallToValue(
|
private fun IrBuilderWithScope.lowerConstructorCallToValue(
|
||||||
expression: IrMemberAccessExpression,
|
expression: IrMemberAccessExpression<*>,
|
||||||
callee: IrConstructor
|
callee: IrConstructor
|
||||||
): IrExpression = if (callee.isPrimary) {
|
): IrExpression = if (callee.isPrimary) {
|
||||||
expression.getValueArgument(0)!!
|
expression.getValueArgument(0)!!
|
||||||
|
|||||||
+1
-1
@@ -266,7 +266,7 @@ internal class EnumConstructorsLowering(val context: Context) : ClassLoweringPas
|
|||||||
throw AssertionError("Unexpected delegating constructor call within enum entry: $enumEntry")
|
throw AssertionError("Unexpected delegating constructor call within enum entry: $enumEntry")
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract fun createConstructorCall(startOffset: Int, endOffset: Int, loweredConstructor: IrConstructorSymbol): IrMemberAccessExpression
|
abstract fun createConstructorCall(startOffset: Int, endOffset: Int, loweredConstructor: IrConstructorSymbol): IrMemberAccessExpression<*>
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class InEnumEntryClassConstructor(enumEntry: IrEnumEntry) : InEnumEntry(enumEntry) {
|
private inner class InEnumEntryClassConstructor(enumEntry: IrEnumEntry) : InEnumEntry(enumEntry) {
|
||||||
|
|||||||
+4
-4
@@ -270,7 +270,7 @@ internal class NativeSuspendFunctionsLowering(ctx: Context): AbstractSuspendFunc
|
|||||||
return sliceExpression(expression)
|
return sliceExpression(expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitMemberAccess(expression: IrMemberAccessExpression): IrExpression {
|
override fun visitMemberAccess(expression: IrMemberAccessExpression<*>): IrExpression {
|
||||||
expression.transformChildrenVoid(this)
|
expression.transformChildrenVoid(this)
|
||||||
|
|
||||||
return sliceExpression(expression)
|
return sliceExpression(expression)
|
||||||
@@ -281,7 +281,7 @@ internal class NativeSuspendFunctionsLowering(ctx: Context): AbstractSuspendFunc
|
|||||||
irBuilder.run {
|
irBuilder.run {
|
||||||
val children = when (expression) {
|
val children = when (expression) {
|
||||||
is IrSetField -> listOf(expression.receiver, expression.value)
|
is IrSetField -> listOf(expression.receiver, expression.value)
|
||||||
is IrMemberAccessExpression -> (
|
is IrMemberAccessExpression<*> -> (
|
||||||
listOf(expression.dispatchReceiver, expression.extensionReceiver)
|
listOf(expression.dispatchReceiver, expression.extensionReceiver)
|
||||||
+ (0 until expression.valueArgumentsCount).map { expression.getValueArgument(it) }
|
+ (0 until expression.valueArgumentsCount).map { expression.getValueArgument(it) }
|
||||||
)
|
)
|
||||||
@@ -365,7 +365,7 @@ internal class NativeSuspendFunctionsLowering(ctx: Context): AbstractSuspendFunc
|
|||||||
expression.receiver = newChildren[0]
|
expression.receiver = newChildren[0]
|
||||||
expression.value = newChildren[1]!!
|
expression.value = newChildren[1]!!
|
||||||
}
|
}
|
||||||
is IrMemberAccessExpression -> {
|
is IrMemberAccessExpression<*> -> {
|
||||||
expression.dispatchReceiver = newChildren[0]
|
expression.dispatchReceiver = newChildren[0]
|
||||||
expression.extensionReceiver = newChildren[1]
|
expression.extensionReceiver = newChildren[1]
|
||||||
newChildren.drop(2).forEachIndexed { index, newChild ->
|
newChildren.drop(2).forEachIndexed { index, newChild ->
|
||||||
@@ -549,7 +549,7 @@ internal class NativeSuspendFunctionsLowering(ctx: Context): AbstractSuspendFunc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrBlockBodyBuilder.irSuccess(value: IrExpression): IrMemberAccessExpression {
|
fun IrBlockBodyBuilder.irSuccess(value: IrExpression): IrMemberAccessExpression<*> {
|
||||||
val createResult = symbols.kotlinResult.owner.constructors.single { it.isPrimary }
|
val createResult = symbols.kotlinResult.owner.constructors.single { it.isPrimary }
|
||||||
return irCall(createResult).apply {
|
return irCall(createResult).apply {
|
||||||
putValueArgument(0, value)
|
putValueArgument(0, value)
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ internal class KTypeGenerator(
|
|||||||
|
|
||||||
private fun IrBuilderWithScope.irKTypeProjectionsList(
|
private fun IrBuilderWithScope.irKTypeProjectionsList(
|
||||||
irTypeArguments: List<IrTypeArgument>
|
irTypeArguments: List<IrTypeArgument>
|
||||||
): IrMemberAccessExpression {
|
): IrMemberAccessExpression<*> {
|
||||||
val kTypeProjectionType = symbols.kTypeProjection.typeWithoutArguments
|
val kTypeProjectionType = symbols.kTypeProjection.typeWithoutArguments
|
||||||
|
|
||||||
return if (irTypeArguments.isEmpty()) {
|
return if (irTypeArguments.isEmpty()) {
|
||||||
|
|||||||
+2
-2
@@ -116,7 +116,7 @@ private class ExpressionValuesExtractor(val context: Context,
|
|||||||
|
|
||||||
is IrWhen -> expression.branches.forEach { forEachValue(it.result, block) }
|
is IrWhen -> expression.branches.forEach { forEachValue(it.result, block) }
|
||||||
|
|
||||||
is IrMemberAccessExpression -> block(expression)
|
is IrMemberAccessExpression<*> -> block(expression)
|
||||||
|
|
||||||
is IrGetValue -> block(expression)
|
is IrGetValue -> block(expression)
|
||||||
|
|
||||||
@@ -319,7 +319,7 @@ internal class ModuleDFGBuilder(val context: Context, val irModule: IrModuleFrag
|
|||||||
|
|
||||||
override fun visitExpression(expression: IrExpression) {
|
override fun visitExpression(expression: IrExpression) {
|
||||||
when (expression) {
|
when (expression) {
|
||||||
is IrMemberAccessExpression,
|
is IrMemberAccessExpression<*>,
|
||||||
is IrGetField,
|
is IrGetField,
|
||||||
is IrGetObjectValue,
|
is IrGetObjectValue,
|
||||||
is IrVararg,
|
is IrVararg,
|
||||||
|
|||||||
+1
-1
@@ -293,7 +293,7 @@ fun IrBuilderWithScope.irCatch(type: IrType) =
|
|||||||
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
* Binds the arguments explicitly represented in the IR to the parameters of the accessed function.
|
||||||
* The arguments are to be evaluated in the same order as they appear in the resulting list.
|
* The arguments are to be evaluated in the same order as they appear in the resulting list.
|
||||||
*/
|
*/
|
||||||
fun IrMemberAccessExpression.getArgumentsWithIr(): List<Pair<IrValueParameter, IrExpression>> {
|
fun IrMemberAccessExpression<*>.getArgumentsWithIr(): List<Pair<IrValueParameter, IrExpression>> {
|
||||||
val res = mutableListOf<Pair<IrValueParameter, IrExpression>>()
|
val res = mutableListOf<Pair<IrValueParameter, IrExpression>>()
|
||||||
val irFunction = when (this) {
|
val irFunction = when (this) {
|
||||||
is IrFunctionAccessExpression -> this.symbol.owner
|
is IrFunctionAccessExpression -> this.symbol.owner
|
||||||
|
|||||||
Reference in New Issue
Block a user