Enable light class analysis mode for AbstractLightAnalysisModeCodegenTest. See also the previous commit.
Note that no test data files are changed, it means that light classes with the light analysis mode enabled are the same as with the full analysis.
This commit is contained in:
committed by
Yan Zhulanow
parent
328286ab14
commit
92282072fc
@@ -70,6 +70,8 @@ abstract class AbstractBytecodeListingTest : CodegenTestCase() {
|
||||
testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES
|
||||
)
|
||||
|
||||
setupEnvironment(myEnvironment)
|
||||
|
||||
loadMultiFiles(files)
|
||||
|
||||
val txtFile = getTextFile(wholeFile)
|
||||
@@ -86,6 +88,8 @@ abstract class AbstractBytecodeListingTest : CodegenTestCase() {
|
||||
KotlinTestUtils.assertEqualsToFile(txtFile, generatedFiles)
|
||||
}
|
||||
|
||||
protected open fun setupEnvironment(environment: KotlinCoreEnvironment) {}
|
||||
|
||||
private class TextCollectingVisitor : ClassVisitor(ASM5) {
|
||||
private class Declaration(val text: String, val annotations: MutableList<String> = arrayListOf())
|
||||
|
||||
|
||||
+10
-2
@@ -16,15 +16,23 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.AnalysisHandlerExtension
|
||||
import org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractLightAnalysisModeCodegenTest : AbstractBytecodeListingTest() {
|
||||
override val classBuilderFactory: ClassBuilderFactory
|
||||
get() = ClassBuilderFactories.TEST_LIGHT_CLASSES
|
||||
get() = ClassBuilderFactories.TEST_KAPT3
|
||||
|
||||
override fun setupEnvironment(environment: KotlinCoreEnvironment) {
|
||||
AnalysisHandlerExtension.registerExtension(environment.project, PartialAnalysisHandlerExtension())
|
||||
}
|
||||
|
||||
|
||||
override fun getTextFile(ktFile: File): File {
|
||||
val boxTestsDir = File("compiler/testData/codegen/box")
|
||||
val outDir = File("compiler/testData/codegen/light-analysis", ktFile.toRelativeString(boxTestsDir)).parent
|
||||
return File(outDir, ktFile.nameWithoutExtension + ".txt")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user