[JS IR] Make assert checks no unbound symbols left conditional

This commit is contained in:
Roman Artemev
2021-11-16 13:47:07 +03:00
committed by TeamCityServer
parent e4585730d6
commit 650b04b4dd
4 changed files with 23 additions and 7 deletions
@@ -25,6 +25,7 @@ import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.ir.util.noUnboundLeft
import org.jetbrains.kotlin.js.backend.ast.JsProgram
import org.jetbrains.kotlin.js.config.JSConfigurationKeys
import org.jetbrains.kotlin.js.config.RuntimeDiagnostic
import org.jetbrains.kotlin.name.FqName
@@ -134,6 +135,8 @@ fun compileIr(
is MainModule.Klib -> dependencyModules
}
val allowUnboundSymbols = configuration[JSConfigurationKeys.PARTIAL_LINKAGE] ?: false
val context = JsIrBackendContext(
moduleDescriptor,
irBuiltIns,
@@ -156,7 +159,9 @@ fun compileIr(
ExternalDependenciesGenerator(symbolTable, irProviders).generateUnboundSymbolsAsDependencies()
deserializer.postProcess()
symbolTable.noUnboundLeft("Unbound symbols at the end of linker")
if (!allowUnboundSymbols) {
symbolTable.noUnboundLeft("Unbound symbols at the end of linker")
}
allModules.forEach { module ->
moveBodilessDeclarationsToSeparatePlace(context, module)