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 ktBody = ktAnonymousInitializer.body!!
|
||||
val irBlockBody = context.irFactory.createBlockBody(ktBody.startOffsetSkippingComments, ktBody.endOffset)
|
||||
if (ktBody is KtBlockExpression) {
|
||||
statementGenerator.generateStatements(ktBody.statements, irBlockBody)
|
||||
} else {
|
||||
irBlockBody.statements.add(statementGenerator.generateStatement(ktBody))
|
||||
if (context.configuration.generateBodies) {
|
||||
if (ktBody is KtBlockExpression) {
|
||||
statementGenerator.generateStatements(ktBody.statements, irBlockBody)
|
||||
} else {
|
||||
irBlockBody.statements.add(statementGenerator.generateStatement(ktBody))
|
||||
}
|
||||
}
|
||||
irAnonymousInitializer.body = irBlockBody
|
||||
}
|
||||
|
||||
+5
@@ -79,6 +79,11 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
||||
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")
|
||||
public void testComments() throws Exception {
|
||||
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");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousInitializer.kt")
|
||||
public void testAnonymousInitializer() throws Exception {
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/anonymousInitializer.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("comments.kt")
|
||||
public void testComments() throws Exception {
|
||||
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