[JS IR BE] basic compiler

This commit is contained in:
Zalim Bashorov
2018-03-14 20:24:02 +03:00
parent 4404c6dd2c
commit e0a070ff35
12 changed files with 202 additions and 16 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.ir.backend.js.compile
import org.jetbrains.kotlin.js.config.JsConfig
import org.jetbrains.kotlin.js.facade.MainCallParameters
import org.jetbrains.kotlin.js.facade.TranslationUnit
import org.jetbrains.kotlin.name.FqName
import java.io.File
abstract class BasicIrBoxTest(
@@ -33,7 +34,14 @@ abstract class BasicIrBoxTest(
testPackage: String?,
testFunction: String
) {
val code = compile(units.map { (it as TranslationUnit.SourceFile).file })
val code = compile(
config.project,
units.map { (it as TranslationUnit.SourceFile).file }
// TODO: temporary ignore _commonFiles/asserts.kt since it depends on stdlib but we don't have any library support in JS IR BE yet
// and probably it will be better to avoid using stdlib in testData as much as possible.
.filter { !it.virtualFilePath.endsWith("js/js.translator/testData/_commonFiles/asserts.kt") },
config.configuration,
FqName((testPackage?.let { it + "." } ?: "") + testFunction))
outputFile.parentFile.mkdirs()
outputFile.writeText(code)
@@ -13731,13 +13731,7 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
@TestMetadata("deeplyNestedPackage.kt")
public void testDeeplyNestedPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/package/deeplyNestedPackage.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive or add it to white list for that.");
doTest(fileName);
}
@TestMetadata("deeplyNestedPackageFunctionCalled.kt")