[K/JS] Add warning for ES-modules on the klibgen stage on the uniqueness of the exported names from the module

This commit is contained in:
Artem Kobzar
2023-08-08 15:45:02 +00:00
committed by Space Team
parent 734a3e5716
commit a29fa428b3
15 changed files with 199 additions and 29 deletions
@@ -147,6 +147,10 @@ open class IrFileSerializer(
protected val protoDebugInfoArray = arrayListOf<String>()
interface FileBackendSpecificMetadata {
fun toByteArray(): ByteArray
}
sealed class XStatementOrExpression {
abstract fun toByteArray(): ByteArray
@@ -1353,6 +1357,7 @@ open class IrFileSerializer(
open fun backendSpecificExplicitRootExclusion(node: IrAnnotationContainer): Boolean = false
open fun keepOrderOfProperties(property: IrProperty): Boolean = !property.isConst
open fun backendSpecificSerializeAllMembers(irClass: IrClass) = false
open fun backendSpecificMetadata(irFile: IrFile): FileBackendSpecificMetadata? = null
open fun memberNeedsSerialization(member: IrDeclaration): Boolean {
val parent = member.parent
@@ -1454,15 +1459,16 @@ open class IrFileSerializer(
serializeExpectActualSubstitutionTable(proto)
return SerializedIrFile(
proto.build().toByteArray(),
file.packageFqName.asString(),
file.path,
IrMemoryArrayWriter(protoTypeArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryArrayWriter(protoIdSignatureArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryStringWriter(protoStringArray).writeIntoMemory(),
IrMemoryArrayWriter(protoBodyArray.map { it.toByteArray() }).writeIntoMemory(),
IrMemoryDeclarationWriter(topLevelDeclarations).writeIntoMemory(),
IrMemoryStringWriter(protoDebugInfoArray).writeIntoMemory()
fileData = proto.build().toByteArray(),
fqName = file.packageFqName.asString(),
path = file.path,
types = IrMemoryArrayWriter(protoTypeArray.map { it.toByteArray() }).writeIntoMemory(),
signatures = IrMemoryArrayWriter(protoIdSignatureArray.map { it.toByteArray() }).writeIntoMemory(),
strings = IrMemoryStringWriter(protoStringArray).writeIntoMemory(),
bodies = IrMemoryArrayWriter(protoBodyArray.map { it.toByteArray() }).writeIntoMemory(),
declarations = IrMemoryDeclarationWriter(topLevelDeclarations).writeIntoMemory(),
debugInfo = IrMemoryStringWriter(protoDebugInfoArray).writeIntoMemory(),
backendSpecificMetadata = backendSpecificMetadata(file)?.toByteArray(),
)
}