[IR] Autogenerate IrFileImpl

#KT-65773 In Progress
This commit is contained in:
Wojciech Litewka
2024-03-01 15:12:54 +01:00
committed by Space Team
parent 2ed0ffd123
commit 4eba0075bb
5 changed files with 32 additions and 15 deletions
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
/**
* Generated from: [org.jetbrains.kotlin.ir.generator.IrTree.file]
*/
abstract class IrFile : IrPackageFragment(), IrMetadataSourceOwner, IrMutableAnnotationContainer {
abstract class IrFile : IrPackageFragment(), IrMutableAnnotationContainer, IrMetadataSourceOwner {
abstract override val symbol: IrFileSymbol
abstract var module: IrModuleFragment
@@ -3,6 +3,11 @@
* 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.
@file:Suppress("DuplicatedCode")
package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.ir.IrFileEntry
@@ -20,15 +25,6 @@ class IrFileImpl(
override val symbol: IrFileSymbol,
override var packageFqName: FqName,
) : IrFile() {
init {
symbol.bind(this)
}
override lateinit var module: IrModuleFragment
internal val isInsideModule: Boolean
get() = ::module.isInitialized
override val startOffset: Int
get() = 0
@@ -41,4 +37,13 @@ class IrFileImpl(
override var annotations: List<IrConstructorCall> = emptyList()
override var metadata: MetadataSource? = null
}
override lateinit var module: IrModuleFragment
internal val isInsideModule: Boolean
get() = ::module.isInitialized
init {
symbol.bind(this)
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -33,7 +33,6 @@ val elementVisitorVoidType = type(visitors, "IrElementVisitorVoid")
val elementTransformerType = type(visitors, "IrElementTransformer")
val elementTransformerVoidType = type(visitors, "IrElementTransformerVoid", TypeKind.Class)
val typeTransformerType = type(visitors, "IrTypeTransformer")
val mutableAnnotationContainerType = type(declarations, "IrMutableAnnotationContainer")
val irTypeType = type(types, "IrType")
val irFactoryType = type(declarations, "IrFactory")
val stageControllerType = type(declarations, "StageController", TypeKind.Class)
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.generators.tree.printer.printPropertyDeclaration
import org.jetbrains.kotlin.ir.generator.config.AbstractIrTreeImplementationConfigurator
import org.jetbrains.kotlin.ir.generator.model.Element
import org.jetbrains.kotlin.ir.generator.model.ListField
import org.jetbrains.kotlin.utils.withIndent
object ImplementationConfigurator : AbstractIrTreeImplementationConfigurator() {
override fun configure(model: Model): Unit = with(IrTree) {
@@ -145,7 +146,19 @@ object ImplementationConfigurator : AbstractIrTreeImplementationConfigurator() {
}
impl(file) {
implementation.doPrint = false
implementation.putImplementationOptInInConstructor = false
implementation.constructorParameterOrderOverride = listOf("fileEntry", "symbol", "packageFqName")
default("startOffset", "0", withGetter = true)
default("endOffset", "fileEntry.maxOffset", withGetter = true)
isMutable("module")
isLateinit("module")
implementation.generationCallback = {
println()
println("internal val isInsideModule: Boolean")
withIndent {
println("get() = ::module.isInitialized")
}
}
}
}
@@ -656,7 +656,7 @@ object IrTree : AbstractTreeBuilder() {
generateIrFactoryMethod = false
parent(packageFragment)
parent(mutableAnnotationContainerType)
parent(mutableAnnotationContainer)
parent(metadataSourceOwner)
+symbol(fileSymbolType)