[K/JS] Remove declarations with @JsExport.Ignore from klib explicit roots

This commit is contained in:
Artem Kobzar
2023-07-17 15:11:47 +00:00
committed by Space Team
parent 6edfda0204
commit df0e4e0b53
2 changed files with 8 additions and 1 deletions
@@ -1359,6 +1359,7 @@ open class IrFileSerializer(
.build()
open fun backendSpecificExplicitRoot(node: IrAnnotationContainer): Boolean = false
open fun backendSpecificExplicitRootExclusion(node: IrAnnotationContainer): Boolean = false
open fun keepOrderOfProperties(property: IrProperty): Boolean = !property.isConst
open fun backendSpecificSerializeAllMembers(irClass: IrClass) = false
@@ -1376,6 +1377,7 @@ open class IrFileSerializer(
if (backendSpecificExplicitRoot(file)) {
for (declaration in file.declarations) {
if (backendSpecificExplicitRootExclusion(declaration)) continue
proto.addExplicitlyExportedToCompiler(serializeIrSymbol(declaration.symbol))
}
} else {
@@ -39,9 +39,14 @@ class JsIrFileSerializer(
) {
companion object {
private val JS_EXPORT_FQN = FqName("kotlin.js.JsExport")
private val JS_EXPORT_IGNORE_FQN = FqName("kotlin.js.JsExport.Ignore")
}
override fun backendSpecificExplicitRoot(node: IrAnnotationContainer): Boolean {
return node.annotations.hasAnnotation(JS_EXPORT_FQN)
return node.annotations.hasAnnotation(JS_EXPORT_FQN) && !backendSpecificExplicitRootExclusion(node)
}
override fun backendSpecificExplicitRootExclusion(node: IrAnnotationContainer): Boolean {
return node.annotations.hasAnnotation(JS_EXPORT_IGNORE_FQN)
}
}