[JS IR] Add to IR keep possibility similar to legacy-dce one
It helps to: - keep declarations even if they are not reachable and not exported - not minify names of not exported declarations Compiler argument: -Xir-keep=A,B Can be used for top-level declarations or for member ^KT-54118 fixed
This commit is contained in:
@@ -6797,6 +6797,16 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/keep")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Keep {
|
||||
@Test
|
||||
public void testAllFilesPresentInKeep() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/keep"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/kotlin.test")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+40
@@ -7269,6 +7269,46 @@ public class FirJsTestGenerated extends AbstractFirJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/keep")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Keep {
|
||||
@Test
|
||||
public void testAllFilesPresentInKeep() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/keep"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepClass.kt")
|
||||
public void testKeepClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepMethod.kt")
|
||||
public void testKeepMethod() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepNestedClass.kt")
|
||||
public void testKeepNestedClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepNestedClassIfKeptTopLevelClass.kt")
|
||||
public void testKeepNestedClassIfKeptTopLevelClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepNestedClassIfKeptTopLevelClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepOverriddenMethod.kt")
|
||||
public void testKeepOverriddenMethod() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepOverriddenMethod.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/kotlin.test")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+40
@@ -7269,6 +7269,46 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/keep")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Keep {
|
||||
@Test
|
||||
public void testAllFilesPresentInKeep() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/keep"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepClass.kt")
|
||||
public void testKeepClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepMethod.kt")
|
||||
public void testKeepMethod() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepNestedClass.kt")
|
||||
public void testKeepNestedClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepNestedClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepNestedClassIfKeptTopLevelClass.kt")
|
||||
public void testKeepNestedClassIfKeptTopLevelClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepNestedClassIfKeptTopLevelClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("keepOverriddenMethod.kt")
|
||||
public void testKeepOverriddenMethod() throws Exception {
|
||||
runTest("js/js.translator/testData/box/keep/keepOverriddenMethod.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/kotlin.test")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Reference in New Issue
Block a user