JVM IR: retain optional annotations as package private classes

Similarly to how it's done in the old backend (see
PackageCodegenImpl.generateClassesAndObjectsInFile and
AnnotationCodegen.genAnnotation)
This commit is contained in:
Alexander Udalov
2019-12-17 19:25:37 +01:00
parent 5d3ef4c632
commit 0cb48999ff
9 changed files with 76 additions and 14 deletions
@@ -15,9 +15,9 @@ import org.jetbrains.kotlin.ir.visitors.acceptVoid
/**
* This pass removes all declarations with `isExpect == true`.
*/
class ExpectDeclarationsRemoveLowering(val context: BackendContext) : FileLoweringPass {
class ExpectDeclarationsRemoveLowering(val context: BackendContext, keepOptionalAnnotations: Boolean = false) : FileLoweringPass {
val visitor = ExpectDeclarationRemover(context.ir.symbols.externalSymbolTable, true)
val visitor = ExpectDeclarationRemover(context.ir.symbols.externalSymbolTable, doRemove = true, keepOptionalAnnotations)
override fun lower(irFile: IrFile) {
irFile.acceptVoid(visitor)