IR: drop IrFile.fileAnnotations (it already has annotations anyway)
This commit is contained in:
+4
-9
@@ -186,9 +186,6 @@ class RenderIrElementWithDescriptorsVisitor : IrElementVisitor<String, Nothing?>
|
||||
internal fun IrDeclaration.name(): String =
|
||||
descriptor.let { it.name.toString() }
|
||||
|
||||
internal fun IrDeclaration.renderDeclared(): String =
|
||||
DECLARATION_RENDERER.render(this.descriptor)
|
||||
|
||||
internal fun DeclarationDescriptor.ref(): String =
|
||||
if (this is ReceiverParameterDescriptor)
|
||||
"<receiver: ${containingDeclaration.ref()}>"
|
||||
@@ -198,8 +195,6 @@ class RenderIrElementWithDescriptorsVisitor : IrElementVisitor<String, Nothing?>
|
||||
internal fun KotlinType.render(): String =
|
||||
DECLARATION_RENDERER.renderType(this)
|
||||
|
||||
internal fun IrDeclaration.renderOrigin(): String =
|
||||
if (origin != IrDeclarationOrigin.DEFINED) origin.toString() + " " else ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,11 +215,11 @@ class DumpIrTreeWithDescriptorsVisitor(out: Appendable) : IrElementVisitor<Unit,
|
||||
|
||||
override fun visitFile(declaration: IrFile, data: String) {
|
||||
declaration.dumpLabeledElementWith(data) {
|
||||
if (declaration.fileAnnotations.isNotEmpty()) {
|
||||
printer.println("fileAnnotations:")
|
||||
if (declaration.annotations.isNotEmpty()) {
|
||||
printer.println("annotations:")
|
||||
indented {
|
||||
declaration.fileAnnotations.forEach {
|
||||
printer.println(ANNOTATIONS_RENDERER.renderAnnotation(it))
|
||||
declaration.annotations.forEach {
|
||||
it.accept(this, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ class ModuleGenerator(override val context: GeneratorContext) : Generator {
|
||||
|
||||
for (ktAnnotationEntry in ktFile.annotationEntries) {
|
||||
val annotationDescriptor = getOrFail(BindingContext.ANNOTATION, ktAnnotationEntry)
|
||||
irFile.fileAnnotations.add(annotationDescriptor)
|
||||
irFile.annotations.add(constantValueGenerator.generateAnnotationConstructorCall(annotationDescriptor))
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
package org.jetbrains.kotlin.ir.declarations
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.SourceManager
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrExternalPackageFragmentSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPackageFragmentSymbol
|
||||
@@ -42,7 +42,6 @@ interface IrFile : IrPackageFragment, IrAnnotationContainer, IrMetadataSourceOwn
|
||||
override val symbol: IrFileSymbol
|
||||
|
||||
val fileEntry: SourceManager.FileEntry
|
||||
val fileAnnotations: MutableList<AnnotationDescriptor>
|
||||
|
||||
override val metadata: MetadataSource.File?
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.ir.declarations.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.ir.IrElementBase
|
||||
import org.jetbrains.kotlin.ir.SourceManager
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
@@ -29,7 +28,6 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrFileSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
class IrFileImpl(
|
||||
override val fileEntry: SourceManager.FileEntry,
|
||||
@@ -42,14 +40,12 @@ class IrFileImpl(
|
||||
constructor(
|
||||
fileEntry: SourceManager.FileEntry,
|
||||
symbol: IrFileSymbol
|
||||
) :
|
||||
this(fileEntry, symbol, symbol.descriptor.fqName)
|
||||
) : this(fileEntry, symbol, symbol.descriptor.fqName)
|
||||
|
||||
constructor(
|
||||
fileEntry: SourceManager.FileEntry,
|
||||
packageFragmentDescriptor: PackageFragmentDescriptor
|
||||
) :
|
||||
this(fileEntry, IrFileSymbolImpl(packageFragmentDescriptor), packageFragmentDescriptor.fqName)
|
||||
) : this(fileEntry, IrFileSymbolImpl(packageFragmentDescriptor), packageFragmentDescriptor.fqName)
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
@@ -57,8 +53,6 @@ class IrFileImpl(
|
||||
|
||||
override val packageFragmentDescriptor: PackageFragmentDescriptor get() = symbol.descriptor
|
||||
|
||||
override val fileAnnotations: MutableList<AnnotationDescriptor> = SmartList()
|
||||
|
||||
override val declarations: MutableList<IrDeclaration> = ArrayList()
|
||||
|
||||
override val annotations: MutableList<IrCall> = ArrayList()
|
||||
|
||||
@@ -110,7 +110,6 @@ open class DeepCopyIrTreeWithSymbols(
|
||||
symbolRenamer.getFileName(declaration.symbol)
|
||||
).apply {
|
||||
transformAnnotations(declaration)
|
||||
fileAnnotations.addAll(declaration.fileAnnotations)
|
||||
declaration.transformDeclarationsTo(this)
|
||||
}
|
||||
|
||||
|
||||
@@ -80,9 +80,6 @@ class DumpIrTreeVisitor(
|
||||
|
||||
override fun visitFile(declaration: IrFile, data: String) {
|
||||
declaration.dumpLabeledElementWith(data) {
|
||||
declaration.fileAnnotations.dumpItemsWith("fileAnnotations") {
|
||||
ANNOTATIONS_RENDERER.renderAnnotation(it)
|
||||
}
|
||||
dumpAnnotations(declaration)
|
||||
declaration.declarations.dumpElements()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
FILE fqName:test fileName:/fileAnnotations.kt
|
||||
fileAnnotations:
|
||||
@test.A(x = "File annotation")
|
||||
annotations:
|
||||
CALL 'CONSTRUCTOR visibility:public <> (x:kotlin.String) returnType:test.A flags:[primary]' type=test.A origin=null
|
||||
x: CONST String type=kotlin.String value="File annotation"
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
FILE fqName:<root> fileName:/fileWithAnnotations.kt
|
||||
fileAnnotations:
|
||||
@kotlin.jvm.JvmName(name = "FileWithAnnotations")
|
||||
annotations:
|
||||
CALL 'CONSTRUCTOR IR_EXTERNAL_DECLARATION_STUB visibility:public <> (name:kotlin.String) returnType:kotlin.jvm.JvmName flags:[primary]' type=kotlin.jvm.JvmName origin=null
|
||||
name: CONST String type=kotlin.String value="FileWithAnnotations"
|
||||
|
||||
Reference in New Issue
Block a user