[JS IC] fix cross-module nested class references and interface inheritance

^ KT-50528 fixed
This commit is contained in:
Anton Bannykh
2021-12-28 13:44:05 +03:00
committed by teamcity
parent 3fe05233e2
commit 1b631da3a0
7 changed files with 74 additions and 4 deletions
@@ -99,7 +99,7 @@ fun compileWithIC(
module.files.filter { it.fileEntry.name in dirties }
} ?: module.files
val ast = transformer.generateBinaryAst(dirtyFiles)
val ast = transformer.generateBinaryAst(dirtyFiles, allModules)
ast.entries.forEach { (path, bytes) -> cacheConsumer.commitBinaryAst(path, bytes) }
}
@@ -104,14 +104,18 @@ class IrModuleToJsTransformerTmp(
return CompilerResult(result, dts)
}
fun generateBinaryAst(files: Iterable<IrFile>): Map<String, ByteArray> {
fun generateBinaryAst(files: Iterable<IrFile>, allModules: Iterable<IrModuleFragment>): Map<String, ByteArray> {
val exportModelGenerator = ExportModelGenerator(backendContext, generateNamespacesForPackages = true)
val exportData = files.associate { file ->
file to exportModelGenerator.generateExportWithExternals(file)
}
files.forEach { StaticMembersLowering(backendContext).lower(it) }
allModules.forEach {
it.files.forEach {
StaticMembersLowering(backendContext).lower(it)
}
}
val serializer = JsIrAstSerializer()
@@ -301,7 +301,7 @@ class JsClassGenerator(private val irClass: IrClass, val context: JsGenerationCo
?.let {
val implClassDeclaration = it.parent as IrClass
if (implClassDeclaration.shouldCopyFrom() && it.body != null) {
if (implClassDeclaration.shouldCopyFrom()) {
val reference = context.getNameForStaticDeclaration(it).makeRef()
classModel.postDeclarationBlock.statements += jsAssignment(memberRef, reference).makeStmt()
if (isFakeOverride) {