From 3d9194c82c97378beb16c83c35a8927bdadd4f74 Mon Sep 17 00:00:00 2001 From: Wojciech Litewka Date: Tue, 13 Feb 2024 14:21:07 +0100 Subject: [PATCH] [IR] Make IrMutableAnnotationContainer an IrElement It is required, so that IR tree generator will properly handle the `annotations` property in subsequent commits, e.g., to include them in implementation classes. All subclasses of IrMutableAnnotationContainer do already derive from IrElement. ^KT-65773 In Progress --- .../IrMutableAnnotationContainer.kt | 21 +++++++++++++++++++ .../ir/declarations/IrAnnotationContainer.kt | 6 +----- .../kotlin/ir/generator/CommonTypes.kt | 1 + .../jetbrains/kotlin/ir/generator/IrTree.kt | 10 ++++++++- 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrMutableAnnotationContainer.kt diff --git a/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrMutableAnnotationContainer.kt b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrMutableAnnotationContainer.kt new file mode 100644 index 00000000000..ebe73f764ca --- /dev/null +++ b/compiler/ir/ir.tree/gen/org/jetbrains/kotlin/ir/declarations/IrMutableAnnotationContainer.kt @@ -0,0 +1,21 @@ +/* + * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +// This file was generated automatically. See compiler/ir/ir.tree/tree-generator/ReadMe.md. +// DO NOT MODIFY IT MANUALLY. + +package org.jetbrains.kotlin.ir.declarations + +import org.jetbrains.kotlin.ir.IrElement +import org.jetbrains.kotlin.ir.expressions.IrConstructorCall + +/** + * A non-leaf IR tree element. + * + * Generated from: [org.jetbrains.kotlin.ir.generator.IrTree.mutableAnnotationContainer] + */ +interface IrMutableAnnotationContainer : IrElement, IrAnnotationContainer { + override var annotations: List +} diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrAnnotationContainer.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrAnnotationContainer.kt index 72fb1c8bb21..8cdc28adf77 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrAnnotationContainer.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/declarations/IrAnnotationContainer.kt @@ -9,8 +9,4 @@ import org.jetbrains.kotlin.ir.expressions.IrConstructorCall interface IrAnnotationContainer { val annotations: List -} - -interface IrMutableAnnotationContainer : IrAnnotationContainer { - override var annotations: List -} +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/CommonTypes.kt b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/CommonTypes.kt index 3aba79b7303..2149b579948 100644 --- a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/CommonTypes.kt +++ b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/CommonTypes.kt @@ -38,6 +38,7 @@ val irTypeType = type(types, "IrType") val irFactoryType = type(declarations, "IrFactory") val stageControllerType = type(declarations, "StageController", TypeKind.Class) val idSignatureType = type(util, "IdSignature", TypeKind.Class) +val irImplementationDetailType = type(tree, "IrImplementationDetail", TypeKind.Class) val symbolType = type(symbols, "IrSymbol") val packageFragmentSymbolType = type(symbols, "IrPackageFragmentSymbol") diff --git a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt index 75521c49aef..4d53e667d08 100644 --- a/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt +++ b/compiler/ir/ir.tree/tree-generator/src/org/jetbrains/kotlin/ir/generator/IrTree.kt @@ -100,7 +100,7 @@ object IrTree : AbstractTreeBuilder() { val declaration: Element by element(Declaration) { parent(statement) parent(symbolOwner) - parent(mutableAnnotationContainerType) + parent(mutableAnnotationContainer) +descriptor("DeclarationDescriptor") +field("origin", type(Packages.declarations, "IrDeclarationOrigin")) @@ -323,6 +323,14 @@ object IrTree : AbstractTreeBuilder() { skipInIrFactory() } } + val mutableAnnotationContainer: Element by element(Declaration) { + parent(type(Packages.declarations, "IrAnnotationContainer")) + + +listField("annotations", constructorCall, mutability = Var, isChild = false) { + fromParent = true + skipInIrFactory() + } + } val anonymousInitializer: Element by element(Declaration) { parent(declarationBase)