KT-52791 Make it possible to pass multiple context receivers to a class
This commit is contained in:
committed by
Space Team
parent
62217b39ec
commit
906c161068
+1
-7
@@ -133,19 +133,13 @@ internal class ClassMemberGenerator(
|
||||
val thisParameter =
|
||||
conversionScope.dispatchReceiverParameter(irClass) ?: error("No found this parameter for $irClass")
|
||||
|
||||
val receiver = IrGetValueImpl(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||
thisParameter.type,
|
||||
thisParameter.symbol,
|
||||
)
|
||||
|
||||
for (index in containingClass.contextReceivers.indices) {
|
||||
val irValueParameter = valueParameters[index]
|
||||
body.statements.add(
|
||||
IrSetFieldImpl(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
|
||||
contextReceiverFields[index].symbol,
|
||||
receiver,
|
||||
IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, thisParameter.type, thisParameter.symbol),
|
||||
IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, irValueParameter.type, irValueParameter.symbol),
|
||||
components.irBuiltIns.unitType,
|
||||
)
|
||||
|
||||
+6
@@ -17215,6 +17215,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/extensionClasses/generics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multiple.kt")
|
||||
public void testMultiple() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionClasses/multiple.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyWithContext.kt")
|
||||
public void testPropertyWithContext() throws Exception {
|
||||
|
||||
Generated
+6
@@ -859,6 +859,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt52791.kt")
|
||||
public void testKt52791() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/kt52791.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lazy.kt")
|
||||
public void testLazy() throws Exception {
|
||||
|
||||
+6
@@ -859,6 +859,12 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex
|
||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/iteratorOperator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt52791.kt")
|
||||
public void testKt52791() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/declarations/contextReceivers/kt52791.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lazy.kt")
|
||||
public void testLazy() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user