Psi2ir: do not generate init block body in kapt mode
This commit is contained in:
+6
-4
@@ -41,10 +41,12 @@ class AnonymousInitializerGenerator(
|
|||||||
val statementGenerator = bodyGenerator.createStatementGenerator()
|
val statementGenerator = bodyGenerator.createStatementGenerator()
|
||||||
val ktBody = ktAnonymousInitializer.body!!
|
val ktBody = ktAnonymousInitializer.body!!
|
||||||
val irBlockBody = context.irFactory.createBlockBody(ktBody.startOffsetSkippingComments, ktBody.endOffset)
|
val irBlockBody = context.irFactory.createBlockBody(ktBody.startOffsetSkippingComments, ktBody.endOffset)
|
||||||
if (ktBody is KtBlockExpression) {
|
if (context.configuration.generateBodies) {
|
||||||
statementGenerator.generateStatements(ktBody.statements, irBlockBody)
|
if (ktBody is KtBlockExpression) {
|
||||||
} else {
|
statementGenerator.generateStatements(ktBody.statements, irBlockBody)
|
||||||
irBlockBody.statements.add(statementGenerator.generateStatement(ktBody))
|
} else {
|
||||||
|
irBlockBody.statements.add(statementGenerator.generateStatement(ktBody))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
irAnonymousInitializer.body = irBlockBody
|
irAnonymousInitializer.body = irBlockBody
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -79,6 +79,11 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
|||||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/anonymousDelegate.kt");
|
runTest("plugins/kapt3/kapt3-compiler/testData/converter/anonymousDelegate.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anonymousInitializer.kt")
|
||||||
|
public void testAnonymousInitializer() throws Exception {
|
||||||
|
runTest("plugins/kapt3/kapt3-compiler/testData/converter/anonymousInitializer.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("comments.kt")
|
@TestMetadata("comments.kt")
|
||||||
public void testComments() throws Exception {
|
public void testComments() throws Exception {
|
||||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/comments.kt");
|
runTest("plugins/kapt3/kapt3-compiler/testData/converter/comments.kt");
|
||||||
|
|||||||
+5
@@ -80,6 +80,11 @@ public class IrClassFileToSourceStubConverterTestGenerated extends AbstractIrCla
|
|||||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/anonymousDelegate.kt");
|
runTest("plugins/kapt3/kapt3-compiler/testData/converter/anonymousDelegate.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("anonymousInitializer.kt")
|
||||||
|
public void testAnonymousInitializer() throws Exception {
|
||||||
|
runTest("plugins/kapt3/kapt3-compiler/testData/converter/anonymousInitializer.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("comments.kt")
|
@TestMetadata("comments.kt")
|
||||||
public void testComments() throws Exception {
|
public void testComments() throws Exception {
|
||||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/comments.kt");
|
runTest("plugins/kapt3/kapt3-compiler/testData/converter/comments.kt");
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class C {
|
||||||
|
fun f() {}
|
||||||
|
|
||||||
|
init {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import java.lang.System;
|
||||||
|
|
||||||
|
@kotlin.Metadata()
|
||||||
|
public final class C {
|
||||||
|
|
||||||
|
public C() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void f() {
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user