Skip to content

Commit 324cad7

Browse files
mcpiromangoodwinnk
authored andcommitted
[IR] Minor: Add parameter names to some Ir*Call calls
1 parent d09d620 commit 324cad7

File tree

19 files changed

+109
-75
lines changed

19 files changed

+109
-75
lines changed

compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/AdapterGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ internal class AdapterGenerator(
283283
endOffset,
284284
type,
285285
adapteeSymbol,
286-
callableReferenceAccess.typeArguments.size,
287-
firAdaptee.valueParameters.size + firAdaptee.contextReceivers.size,
286+
typeArgumentsCount = callableReferenceAccess.typeArguments.size,
287+
valueArgumentsCount = firAdaptee.valueParameters.size + firAdaptee.contextReceivers.size,
288288
origin = null,
289289
superQualifierSymbol = null
290290
)

compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ fun CommonBackendContext.createArrayOfExpression(
111111
endOffset,
112112
arrayType,
113113
ir.symbols.arrayOf,
114-
1,
115-
1
114+
typeArgumentsCount = 1,
115+
valueArgumentsCount = 1
116116
).apply {
117117
putTypeArgument(0, arrayElementType)
118118
putValueArgument(0, arg0)

compiler/ir/backend.common/test/org/jetbrains/kotlin/backend/common/IrValidatorTest.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ class IrValidatorTest {
7474
returnType = TestIrBuiltins.anyType
7575
}
7676
val functionCall =
77-
IrCallImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, TestIrBuiltins.anyType, function.symbol, 0, 1).apply {
77+
IrCallImpl(
78+
UNDEFINED_OFFSET, UNDEFINED_OFFSET, TestIrBuiltins.anyType, function.symbol,
79+
typeArgumentsCount = 0,
80+
valueArgumentsCount = 1,
81+
).apply {
7882
dispatchReceiver = stringConcatenationWithWrongType
7983
putValueArgument(0, stringConcatenationWithWrongType)
8084
}
@@ -95,7 +99,11 @@ class IrValidatorTest {
9599
val body = IrFactoryImpl.createBlockBody(5, 24)
96100
val stringConcatenationWithWrongType = IrStringConcatenationImpl(9, 20, TestIrBuiltins.anyType)
97101
val functionCall =
98-
IrCallImpl(6, 23, TestIrBuiltins.anyType, function.symbol, 0, 1).apply {
102+
IrCallImpl(
103+
6, 23, TestIrBuiltins.anyType, function.symbol,
104+
typeArgumentsCount = 0,
105+
valueArgumentsCount = 1,
106+
).apply {
99107
dispatchReceiver = stringConcatenationWithWrongType
100108
putValueArgument(0, stringConcatenationWithWrongType)
101109
}

compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ class CallableReferenceLowering(private val context: JsCommonBackendContext) : B
6464
val vpCount = if (function.isSuspend) 1 else 0
6565
val ctorCall =
6666
IrConstructorCallImpl(
67-
startOffset, endOffset, type, ctor.symbol, 0 /*TODO: properly set type arguments*/, 0, vpCount,
68-
JsStatementOrigins.CALLABLE_REFERENCE_CREATE
67+
startOffset, endOffset, type, ctor.symbol,
68+
typeArgumentsCount = 0 /*TODO: properly set type arguments*/,
69+
constructorTypeArgumentsCount = 0,
70+
valueArgumentsCount = vpCount,
71+
origin = JsStatementOrigins.CALLABLE_REFERENCE_CREATE
6972
).apply {
7073
if (function.isSuspend) {
7174
putValueArgument(0, IrConstImpl.constNull(startOffset, endOffset, context.irBuiltIns.nothingNType))
@@ -87,8 +90,10 @@ class CallableReferenceLowering(private val context: JsCommonBackendContext) : B
8790
val vpCount = if (boundReceiver != null) 1 else 0
8891
val ctorCall = IrConstructorCallImpl(
8992
startOffset, endOffset, type, ctor.symbol,
90-
0 /*TODO: properly set type arguments*/, 0,
91-
vpCount, JsStatementOrigins.CALLABLE_REFERENCE_CREATE
93+
typeArgumentsCount = 0, /*TODO: properly set type arguments*/
94+
constructorTypeArgumentsCount = 0,
95+
valueArgumentsCount = vpCount,
96+
origin = JsStatementOrigins.CALLABLE_REFERENCE_CREATE
9297
).apply {
9398
boundReceiver?.let {
9499
putValueArgument(0, it)

compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/InteropCallableReferenceLowering.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo
433433
UNDEFINED_OFFSET,
434434
invokeFun.returnType,
435435
invokeFun.symbol,
436-
0,
437-
invokeFun.valueParameters.size,
438-
JsStatementOrigins.EXPLICIT_INVOKE,
439-
null
436+
typeArgumentsCount = 0,
437+
valueArgumentsCount = invokeFun.valueParameters.size,
438+
origin = JsStatementOrigins.EXPLICIT_INVOKE,
439+
superQualifierSymbol = null
440440
)
441441

442442
fun getValue(d: IrValueDeclaration): IrExpression = IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, d.symbol)

compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/InvokeStaticInitializersLowering.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class InvokeStaticInitializersLowering(val context: JsCommonBackendContext) : Bo
3434
irClass.endOffset,
3535
context.irBuiltIns.unitType,
3636
instance.symbol,
37-
0,
38-
0,
39-
JsStatementOrigins.SYNTHESIZED_STATEMENT
37+
typeArgumentsCount = 0,
38+
valueArgumentsCount = 0,
39+
origin = JsStatementOrigins.SYNTHESIZED_STATEMENT
4040
)
4141

4242
(irBody as IrStatementContainer).statements.add(0, getInstanceCall)

compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsDefaultParameterInjector.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ class JsDefaultParameterInjector(context: JsIrBackendContext) :
7979
UNDEFINED_OFFSET,
8080
context.dynamicType,
8181
context.intrinsics.jsPrototypeOfSymbol,
82-
0,
83-
1
82+
typeArgumentsCount = 0,
83+
valueArgumentsCount = 1
8484
).apply {
8585
putValueArgument(0, owner.jsConstructorReference(context))
8686
}

compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyReferenceLowering.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ class PropertyReferenceLowering(private val context: JsIrBackendContext) : BodyL
191191
}
192192

193193
private fun IrExpression.getJsTypeConstructor(): IrExpression {
194-
val irCall = IrCallImpl(startOffset, endOffset, jsClassSymbol.owner.returnType, jsClassSymbol, 1, 0)
194+
val irCall = IrCallImpl(
195+
startOffset, endOffset, jsClassSymbol.owner.returnType, jsClassSymbol,
196+
typeArgumentsCount = 1,
197+
valueArgumentsCount = 0,
198+
)
195199
irCall.putTypeArgument(0, type)
196200
return irCall
197201
}
@@ -225,7 +229,7 @@ class PropertyReferenceLowering(private val context: JsIrBackendContext) : BodyL
225229
expression.transformChildrenVoid(this)
226230

227231
val builderCall = expression.run {
228-
IrCallImpl(startOffset, endOffset, type, localDelegateBuilderSymbol, typeArgumentsCount, 4)
232+
IrCallImpl(startOffset, endOffset, type, localDelegateBuilderSymbol, typeArgumentsCount, valueArgumentsCount = 4)
229233
}
230234

231235
val localName = expression.symbol.owner.name.asString()

compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,14 @@ internal class JvmInlineClassLowering(context: JvmBackendContext) : JvmValueClas
241241
?: return super.visitFunctionAccess(expression)
242242

243243
return IrCallImpl(
244-
expression.startOffset, expression.endOffset, function.returnType.substitute(expression.typeSubstitutionMap),
245-
replacement.symbol, replacement.typeParameters.size, replacement.valueParameters.size,
246-
expression.origin, (expression as? IrCall)?.superQualifierSymbol
244+
startOffset = expression.startOffset,
245+
endOffset = expression.endOffset,
246+
type = function.returnType.substitute(expression.typeSubstitutionMap),
247+
symbol = replacement.symbol,
248+
typeArgumentsCount = replacement.typeParameters.size,
249+
valueArgumentsCount = replacement.valueParameters.size,
250+
origin = expression.origin,
251+
superQualifierSymbol = (expression as? IrCall)?.superQualifierSymbol
247252
).apply {
248253
buildReplacement(function, expression, replacement)
249254
}

compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/ReplaceNumberToCharCallSitesLowering.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ internal class ReplaceNumberToCharCallSitesLowering(val context: JvmBackendConte
5151
val dispatchReceiver = expression.dispatchReceiver ?: return
5252
expression.dispatchReceiver = IrCallImpl(
5353
dispatchReceiver.startOffset, dispatchReceiver.endOffset,
54-
context.irBuiltIns.intType, context.irBuiltIns.numberClass.functionByName("toInt"), 0, 0,
54+
context.irBuiltIns.intType, context.irBuiltIns.numberClass.functionByName("toInt"),
55+
typeArgumentsCount = 0,
56+
valueArgumentsCount = 0,
5557
).also { toInt ->
5658
toInt.dispatchReceiver = dispatchReceiver
5759
}

0 commit comments

Comments
 (0)