[JS IR] Fix compilation after rebase

This commit is contained in:
Ilya Goncharov
2021-02-18 10:31:06 +03:00
committed by TeamCityServer
parent 0182c09318
commit 0e00186ca1
5 changed files with 23 additions and 27 deletions
@@ -206,7 +206,8 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
irFactory = PersistentIrFactory(), // TODO IrFactoryImpl? irFactory = PersistentIrFactory(), // TODO IrFactoryImpl?
outputKlibPath = outputFile.path, outputKlibPath = outputFile.path,
nopack = arguments.irProduceKlibDir, nopack = arguments.irProduceKlibDir,
jsOutputName = FileUtil.getNameWithoutExtension(outputFile),) jsOutputName = FileUtil.getNameWithoutExtension(outputFile),
)
} }
if (arguments.irProduceJs) { if (arguments.irProduceJs) {
@@ -56,7 +56,7 @@ fun compile(
irPerModulePrefix: String? = null, irPerModulePrefix: String? = null,
): CompilerResult { ): CompilerResult {
val (moduleFragment: IrModuleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer, moduleToName) = val (moduleFragment: IrModuleFragment, dependencyModules, irBuiltIns, symbolTable, deserializer, moduleToName) =
loadIr(project, mainModule, analyzer, configuration, allDependencies, friendDependencies, irFactory) loadIr(project, mainModule, analyzer, configuration, allDependencies, friendDependencies, irFactory, forceAllJs)
val moduleDescriptor = moduleFragment.descriptor val moduleDescriptor = moduleFragment.descriptor
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.IrLoop import org.jetbrains.kotlin.ir.expressions.IrLoop
import org.jetbrains.kotlin.ir.util.parentAsClass import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.js.backend.ast.JsName import org.jetbrains.kotlin.js.backend.ast.JsName
import org.jetbrains.kotlin.js.backend.ast.JsNameRef
class IrNamerImpl( class IrNamerImpl(
private val newNameTables: NameTables, private val newNameTables: NameTables,
@@ -41,8 +42,6 @@ class IrNamerImpl(
} }
} }
override fun getNameForValueDeclaration(declaration: IrValueDeclaration): JsName =
getNameForStaticDeclaration(declaration)
override fun getNameForClass(klass: IrClass): JsName = override fun getNameForClass(klass: IrClass): JsName =
getNameForStaticDeclaration(klass) getNameForStaticDeclaration(klass)
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.js.backend.ast.JsGlobalBlock
class JsStaticContext( class JsStaticContext(
val backendContext: JsIrBackendContext, val backendContext: JsIrBackendContext,
private val irNamer: IrNamer, private val irNamer: IrNamer,
val globalNameScope: NameScope val globalNameScope: NameScope,
) : IrNamer by irNamer { ) : IrNamer by irNamer {
val intrinsics = JsIntrinsicTransformers(backendContext) val intrinsics = JsIntrinsicTransformers(backendContext)
val classModels = mutableMapOf<IrClassSymbol, JsIrClassModel>() val classModels = mutableMapOf<IrClassSymbol, JsIrClassModel>()
@@ -547,7 +547,8 @@ fun serializeModuleIntoKlib(
val serializedMetadata = val serializedMetadata =
metadataSerializer.serializedMetadata( metadataSerializer.serializedMetadata(
compiledKotlinFiles.groupBy { it.irData.fqName }.map { (fqn, data) -> fqn to data.sortedBy { it.irData.path }.map { it.metadata } }.toMap(), compiledKotlinFiles.groupBy { it.irData.fqName }
.map { (fqn, data) -> fqn to data.sortedBy { it.irData.path }.map { it.metadata } }.toMap(),
header header
) )
@@ -561,34 +562,29 @@ fun serializeModuleIntoKlib(
irVersion = KlibIrVersion.INSTANCE.toString() irVersion = KlibIrVersion.INSTANCE.toString()
) )
val properties = if (containsErrorCode) {
Properties().also {
it.setProperty(KLIB_PROPERTY_CONTAINS_ERROR_CODE, "true")
}
} else null
val properties = Properties().also { p -> val properties = Properties().also { p ->
if (jsOutputName != null) { if (jsOutputName != null) {
p.setProperty(KLIB_PROPERTY_JS_OUTPUT_NAME, jsOutputName) p.setProperty(KLIB_PROPERTY_JS_OUTPUT_NAME, jsOutputName)
} }
if (containsErrorCode) { if (containsErrorCode) {
p.setProperty(KLIB_PROPERTY_CONTAINS_ERROR_CODE, "true") p.setProperty(KLIB_PROPERTY_CONTAINS_ERROR_CODE, "true")
}
} }
buildKotlinLibrary( buildKotlinLibrary(
linkDependencies = dependencies, linkDependencies = dependencies,
ir = fullSerializedIr, ir = fullSerializedIr,
metadata = serializedMetadata, metadata = serializedMetadata,
dataFlowGraph = null, dataFlowGraph = null,
manifestProperties = properties, manifestProperties = properties,
moduleName = moduleName, moduleName = moduleName,
nopack = nopack, nopack = nopack,
perFile = perFile, perFile = perFile,
output = klibPath, output = klibPath,
versions = versions, versions = versions,
builtInsPlatform = BuiltInsPlatform.JS builtInsPlatform = BuiltInsPlatform.JS
) )
} }
const val KLIB_PROPERTY_JS_OUTPUT_NAME = "jsOutputName" const val KLIB_PROPERTY_JS_OUTPUT_NAME = "jsOutputName"