[JS IR] Add test with boolean in external interface
[JS IR] Add possibility to safely access Boolean in external declaration [JS IR] Add diagnostic for booleans in externals
This commit is contained in:
@@ -150,6 +150,7 @@ abstract class BasicBoxTest(
|
||||
val splitPerModule = SPLIT_PER_MODULE.matcher(fileContent).find()
|
||||
|
||||
val propertyLazyInitialization = PROPERTY_LAZY_INITIALIZATION.matcher(fileContent).find()
|
||||
val safeExternalBoolean = SAFE_EXTERNAL_BOOLEAN.matcher(fileContent).find()
|
||||
|
||||
TestFileFactoryImpl().use { testFactory ->
|
||||
val inputFiles = TestFiles.createTestFiles(
|
||||
@@ -214,7 +215,8 @@ abstract class BasicBoxTest(
|
||||
skipDceDriven,
|
||||
splitPerModule,
|
||||
errorPolicy,
|
||||
propertyLazyInitialization
|
||||
propertyLazyInitialization,
|
||||
safeExternalBoolean
|
||||
)
|
||||
|
||||
when {
|
||||
@@ -468,6 +470,7 @@ abstract class BasicBoxTest(
|
||||
splitPerModule: Boolean,
|
||||
errorIgnorancePolicy: ErrorTolerancePolicy,
|
||||
propertyLazyInitialization: Boolean,
|
||||
safeExternalBoolean: Boolean,
|
||||
) {
|
||||
val kotlinFiles = module.files.filter { it.fileName.endsWith(".kt") }
|
||||
val testFiles = kotlinFiles.map { it.fileName }
|
||||
@@ -518,6 +521,7 @@ abstract class BasicBoxTest(
|
||||
skipDceDriven,
|
||||
splitPerModule,
|
||||
propertyLazyInitialization,
|
||||
safeExternalBoolean,
|
||||
)
|
||||
|
||||
if (incrementalCompilationChecksEnabled && module.hasFilesToRecompile) {
|
||||
@@ -608,10 +612,11 @@ abstract class BasicBoxTest(
|
||||
testPackage,
|
||||
testFunction,
|
||||
needsFullIrRuntime,
|
||||
isMainModule = false,
|
||||
skipDceDriven = true,
|
||||
splitPerModule = false,
|
||||
isMainModule = false,
|
||||
skipDceDriven = true,
|
||||
splitPerModule = false,
|
||||
propertyLazyInitialization = false,
|
||||
safeExternalBoolean = false,
|
||||
)
|
||||
|
||||
val originalOutput = FileUtil.loadFile(outputFile)
|
||||
@@ -691,6 +696,7 @@ abstract class BasicBoxTest(
|
||||
skipDceDriven: Boolean,
|
||||
splitPerModule: Boolean,
|
||||
propertyLazyInitialization: Boolean,
|
||||
safeExternalBoolean: Boolean,
|
||||
) {
|
||||
val translator = K2JSTranslator(config, false)
|
||||
val translationResult = translator.translateUnits(ExceptionThrowingReporter, units, mainCallParameters)
|
||||
@@ -1094,6 +1100,8 @@ abstract class BasicBoxTest(
|
||||
|
||||
private val PROPERTY_LAZY_INITIALIZATION = Pattern.compile("^// *PROPERTY_LAZY_INITIALIZATION *$", Pattern.MULTILINE)
|
||||
|
||||
private val SAFE_EXTERNAL_BOOLEAN = Pattern.compile("^// *SAFE_EXTERNAL_BOOLEAN *$", Pattern.MULTILINE)
|
||||
|
||||
@JvmStatic
|
||||
protected val runTestInNashorn = getBoolean("kotlin.js.useNashorn")
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ abstract class BasicIrBoxTest(
|
||||
skipDceDriven: Boolean,
|
||||
splitPerModule: Boolean,
|
||||
propertyLazyInitialization: Boolean,
|
||||
safeExternalBoolean: Boolean,
|
||||
) {
|
||||
val filesToCompile = units.map { (it as TranslationUnit.SourceFile).file }
|
||||
|
||||
@@ -150,7 +151,8 @@ abstract class BasicIrBoxTest(
|
||||
es6mode = runEs6Mode,
|
||||
multiModule = splitPerModule || perModule,
|
||||
propertyLazyInitialization = propertyLazyInitialization,
|
||||
lowerPerModule = lowerPerModule
|
||||
lowerPerModule = lowerPerModule,
|
||||
safeExternalBoolean = safeExternalBoolean,
|
||||
)
|
||||
|
||||
compiledModule.jsCode!!.writeTo(outputFile, config)
|
||||
@@ -179,7 +181,8 @@ abstract class BasicIrBoxTest(
|
||||
dceDriven = true,
|
||||
es6mode = runEs6Mode,
|
||||
multiModule = splitPerModule || perModule,
|
||||
propertyLazyInitialization = propertyLazyInitialization
|
||||
propertyLazyInitialization = propertyLazyInitialization,
|
||||
safeExternalBoolean = safeExternalBoolean,
|
||||
).jsCode!!.writeTo(pirOutputFile, config)
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user