Search in sources :

Example 1 with PartialAnalysisHandlerExtension

use of org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension in project kotlin by JetBrains.

the class AbstractBlackBoxCodegenTest method doLightAnalysisModeTest.

private void doLightAnalysisModeTest(@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir) {
    if (SKIP_LIGHT_ANALYSIS_MODE_TESTS)
        return;
    File boxTestsDir = new File("compiler/testData/codegen/box");
    String relativePath = FilesKt.toRelativeString(wholeFile, boxTestsDir);
    // Do nothing if this test is not under codegen/box
    if (relativePath.startsWith(".."))
        return;
    String outDir = new File("compiler/testData/codegen/light-analysis", relativePath).getParent();
    File txtFile = new File(outDir, FilesKt.getNameWithoutExtension(wholeFile) + ".txt");
    AbstractBytecodeListingTest.doTest(getTestRootDisposable(), files, javaFilesDir, txtFile, ClassBuilderFactories.TEST_KAPT3, new Function1<KotlinCoreEnvironment, Unit>() {

        @Override
        public Unit invoke(KotlinCoreEnvironment environment) {
            AnalysisHandlerExtension.Companion.registerExtension(environment.getProject(), new PartialAnalysisHandlerExtension());
            return Unit.INSTANCE;
        }
    });
}
Also used : KotlinCoreEnvironment(org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment) PartialAnalysisHandlerExtension(org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension) Unit(kotlin.Unit) KtFile(org.jetbrains.kotlin.psi.KtFile) File(java.io.File)

Aggregations

File (java.io.File)1 Unit (kotlin.Unit)1 KotlinCoreEnvironment (org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment)1 KtFile (org.jetbrains.kotlin.psi.KtFile)1 PartialAnalysisHandlerExtension (org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension)1