IR: make most properties mutable

This commit is contained in:
Alexander Udalov
2023-02-13 14:53:10 +01:00
committed by Space Team
parent d2938e732a
commit 22b4b29292
94 changed files with 419 additions and 336 deletions
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir.lazy
import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.fir.FirAnnotationContainer
import org.jetbrains.kotlin.fir.backend.Fir2IrComponents import org.jetbrains.kotlin.fir.backend.Fir2IrComponents
import org.jetbrains.kotlin.fir.backend.declareThisReceiverParameter import org.jetbrains.kotlin.fir.backend.declareThisReceiverParameter
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
@@ -38,37 +37,58 @@ abstract class AbstractFir2IrLazyFunction<F : FirCallableDeclaration>(
override val endOffset: Int, override val endOffset: Int,
override var origin: IrDeclarationOrigin, override var origin: IrDeclarationOrigin,
override val symbol: IrSimpleFunctionSymbol, override val symbol: IrSimpleFunctionSymbol,
override val isFakeOverride: Boolean override var isFakeOverride: Boolean
) : IrSimpleFunction(), AbstractFir2IrLazyDeclaration<F>, Fir2IrTypeParametersContainer, IrLazyFunctionBase, ) : IrSimpleFunction(), AbstractFir2IrLazyDeclaration<F>, Fir2IrTypeParametersContainer, IrLazyFunctionBase,
Fir2IrComponents by components { Fir2IrComponents by components {
override lateinit var typeParameters: List<IrTypeParameter> override lateinit var typeParameters: List<IrTypeParameter>
override lateinit var parent: IrDeclarationParent override lateinit var parent: IrDeclarationParent
override val isTailrec: Boolean override var isTailrec: Boolean
get() = fir.isTailRec get() = fir.isTailRec
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isSuspend: Boolean override var isSuspend: Boolean
get() = fir.isSuspend get() = fir.isSuspend
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isOperator: Boolean override var isOperator: Boolean
get() = fir.isOperator get() = fir.isOperator
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isInfix: Boolean override var isInfix: Boolean
get() = fir.isInfix get() = fir.isInfix
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
@ObsoleteDescriptorBasedAPI @ObsoleteDescriptorBasedAPI
override val descriptor: FunctionDescriptor override val descriptor: FunctionDescriptor
get() = symbol.descriptor get() = symbol.descriptor
override val isInline: Boolean override var isInline: Boolean
get() = fir.isInline get() = fir.isInline
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExternal: Boolean override var isExternal: Boolean
get() = fir.isExternal get() = fir.isExternal
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExpect: Boolean override var isExpect: Boolean
get() = fir.isExpect get() = fir.isExpect
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override var body: IrBody? by lazyVar(lock) { override var body: IrBody? by lazyVar(lock) {
if (tryLoadIr()) body else null if (tryLoadIr()) body else null
@@ -78,8 +98,11 @@ abstract class AbstractFir2IrLazyFunction<F : FirCallableDeclaration>(
components.visibilityConverter.convertToDescriptorVisibility(fir.visibility) components.visibilityConverter.convertToDescriptorVisibility(fir.visibility)
} }
override val modality: Modality override var modality: Modality
get() = fir.modality!! get() = fir.modality!!
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override var correspondingPropertySymbol: IrPropertySymbol? = null override var correspondingPropertySymbol: IrPropertySymbol? = null
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.fir.lazy package org.jetbrains.kotlin.fir.lazy
import org.jetbrains.kotlin.KtFakeSourceElementKind
import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.fir.backend.* import org.jetbrains.kotlin.fir.backend.*
import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.*
@@ -83,29 +82,53 @@ class Fir2IrLazyClass(
error("Mutating Fir2Ir lazy elements is not possible") error("Mutating Fir2Ir lazy elements is not possible")
} }
override val kind: ClassKind override var kind: ClassKind
get() = fir.classKind get() = fir.classKind
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isCompanion: Boolean override var isCompanion: Boolean
get() = fir.isCompanion get() = fir.isCompanion
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isInner: Boolean override var isInner: Boolean
get() = fir.isInner get() = fir.isInner
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isData: Boolean override var isData: Boolean
get() = fir.isData get() = fir.isData
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExternal: Boolean override var isExternal: Boolean
get() = fir.isExternal get() = fir.isExternal
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isValue: Boolean override var isValue: Boolean
get() = fir.isInline get() = fir.isInline
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExpect: Boolean override var isExpect: Boolean
get() = fir.isExpect get() = fir.isExpect
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isFun: Boolean override var isFun: Boolean
get() = fir.isFun get() = fir.isFun
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override var superTypes: List<IrType> by lazyVar(lock) { override var superTypes: List<IrType> by lazyVar(lock) {
fir.superTypeRefs.map { it.toIrType(typeConverter) } fir.superTypeRefs.map { it.toIrType(typeConverter) }
@@ -46,21 +46,33 @@ class Fir2IrLazyConstructor(
override lateinit var typeParameters: List<IrTypeParameter> override lateinit var typeParameters: List<IrTypeParameter>
override lateinit var parent: IrDeclarationParent override lateinit var parent: IrDeclarationParent
override val isPrimary: Boolean override var isPrimary: Boolean
get() = fir.isPrimary get() = fir.isPrimary
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
@ObsoleteDescriptorBasedAPI @ObsoleteDescriptorBasedAPI
override val descriptor: ClassConstructorDescriptor override val descriptor: ClassConstructorDescriptor
get() = symbol.descriptor get() = symbol.descriptor
override val isInline: Boolean override var isInline: Boolean
get() = fir.isInline get() = fir.isInline
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExternal: Boolean override var isExternal: Boolean
get() = fir.isExternal get() = fir.isExternal
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExpect: Boolean override var isExpect: Boolean
get() = fir.isExpect get() = fir.isExpect
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override var body: IrBody? = null override var body: IrBody? = null
@@ -39,7 +39,7 @@ class Fir2IrLazyProperty(
override val fir: FirProperty, override val fir: FirProperty,
val containingClass: FirRegularClass?, val containingClass: FirRegularClass?,
override val symbol: Fir2IrPropertySymbol, override val symbol: Fir2IrPropertySymbol,
override val isFakeOverride: Boolean override var isFakeOverride: Boolean
) : IrProperty(), AbstractFir2IrLazyDeclaration<FirProperty>, Fir2IrComponents by components { ) : IrProperty(), AbstractFir2IrLazyDeclaration<FirProperty>, Fir2IrComponents by components {
init { init {
symbol.bind(this) symbol.bind(this)
@@ -53,23 +53,41 @@ class Fir2IrLazyProperty(
override val descriptor: PropertyDescriptor override val descriptor: PropertyDescriptor
get() = symbol.descriptor get() = symbol.descriptor
override val isVar: Boolean override var isVar: Boolean
get() = fir.isVar get() = fir.isVar
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isConst: Boolean override var isConst: Boolean
get() = fir.isConst get() = fir.isConst
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isLateinit: Boolean override var isLateinit: Boolean
get() = fir.isLateInit get() = fir.isLateInit
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isDelegated: Boolean override var isDelegated: Boolean
get() = fir.delegate != null get() = fir.delegate != null
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExternal: Boolean override var isExternal: Boolean
get() = fir.isExternal get() = fir.isExternal
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override val isExpect: Boolean override var isExpect: Boolean
get() = fir.isExpect get() = fir.isExpect
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override var name: Name override var name: Name
get() = fir.name get() = fir.name
@@ -83,8 +101,11 @@ class Fir2IrLazyProperty(
error("Mutating Fir2Ir lazy elements is not possible") error("Mutating Fir2Ir lazy elements is not possible")
} }
override val modality: Modality override var modality: Modality
get() = fir.modality!! get() = fir.modality!!
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
private val type: IrType by lazy { private val type: IrType by lazy {
with(typeConverter) { fir.returnTypeRef.toIrType() } with(typeConverter) { fir.returnTypeRef.toIrType() }
@@ -44,8 +44,11 @@ class Fir2IrLazyPropertyAccessor(
get() = firAccessor ?: firParentProperty get() = firAccessor ?: firParentProperty
// TODO: investigate why some deserialized properties are inline // TODO: investigate why some deserialized properties are inline
override val isInline: Boolean override var isInline: Boolean
get() = firAccessor?.isInline == true get() = firAccessor?.isInline == true
set(_) {
error("Mutating Fir2Ir lazy elements is not possible")
}
override var annotations: List<IrConstructorCall> by createLazyAnnotations() override var annotations: List<IrConstructorCall> by createLazyAnnotations()
@@ -655,7 +655,7 @@ class FunctionInlining(
private class IrGetValueWithoutLocation( private class IrGetValueWithoutLocation(
override val symbol: IrValueSymbol, override val symbol: IrValueSymbol,
override val origin: IrStatementOrigin? = null override var origin: IrStatementOrigin? = null
) : IrGetValue() { ) : IrGetValue() {
override val startOffset: Int get() = UNDEFINED_OFFSET override val startOffset: Int get() = UNDEFINED_OFFSET
override val endOffset: Int get() = UNDEFINED_OFFSET override val endOffset: Int get() = UNDEFINED_OFFSET
@@ -25,7 +25,7 @@ abstract class IrAnonymousInitializer : IrDeclarationBase() {
abstract override val symbol: IrAnonymousInitializerSymbol abstract override val symbol: IrAnonymousInitializerSymbol
abstract val isStatic: Boolean abstract var isStatic: Boolean
abstract var body: IrBlockBody abstract var body: IrBlockBody
@@ -34,21 +34,21 @@ abstract class IrClass : IrDeclarationBase(), IrPossiblyExternalDeclaration,
abstract override val symbol: IrClassSymbol abstract override val symbol: IrClassSymbol
abstract val kind: ClassKind abstract var kind: ClassKind
abstract var modality: Modality abstract var modality: Modality
abstract val isCompanion: Boolean abstract var isCompanion: Boolean
abstract val isInner: Boolean abstract var isInner: Boolean
abstract val isData: Boolean abstract var isData: Boolean
abstract val isValue: Boolean abstract var isValue: Boolean
abstract val isExpect: Boolean abstract var isExpect: Boolean
abstract val isFun: Boolean abstract var isFun: Boolean
abstract val source: SourceElement abstract val source: SourceElement
@@ -23,7 +23,7 @@ abstract class IrConstructor : IrFunction() {
abstract override val symbol: IrConstructorSymbol abstract override val symbol: IrConstructorSymbol
abstract val isPrimary: Boolean abstract var isPrimary: Boolean
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitConstructor(this, data) visitor.visitConstructor(this, data)
@@ -30,9 +30,9 @@ abstract class IrField : IrDeclarationBase(), IrPossiblyExternalDeclaration,
abstract var type: IrType abstract var type: IrType
abstract val isFinal: Boolean abstract var isFinal: Boolean
abstract val isStatic: Boolean abstract var isStatic: Boolean
abstract var initializer: IrExpressionBody? abstract var initializer: IrExpressionBody?
@@ -22,9 +22,9 @@ abstract class IrFile : IrPackageFragment(), IrMetadataSourceOwner,
IrMutableAnnotationContainer { IrMutableAnnotationContainer {
abstract override val symbol: IrFileSymbol abstract override val symbol: IrFileSymbol
abstract val module: IrModuleFragment abstract var module: IrModuleFragment
abstract val fileEntry: IrFileEntry abstract var fileEntry: IrFileEntry
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitFile(this, data) visitor.visitFile(this, data)
@@ -29,9 +29,9 @@ abstract class IrFunction : IrDeclarationBase(), IrPossiblyExternalDeclaration,
abstract override val symbol: IrFunctionSymbol abstract override val symbol: IrFunctionSymbol
abstract val isInline: Boolean abstract var isInline: Boolean
abstract val isExpect: Boolean abstract var isExpect: Boolean
abstract var returnType: IrType abstract var returnType: IrType
@@ -28,7 +28,7 @@ abstract class IrLocalDelegatedProperty : IrDeclarationBase(), IrDeclarationWith
abstract var type: IrType abstract var type: IrType
abstract val isVar: Boolean abstract var isVar: Boolean
abstract var delegate: IrVariable abstract var delegate: IrVariable
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.symbols.IrSymbol
interface IrOverridableDeclaration<S : IrSymbol> : IrOverridableMember { interface IrOverridableDeclaration<S : IrSymbol> : IrOverridableMember {
override val symbol: S override val symbol: S
val isFakeOverride: Boolean var isFakeOverride: Boolean
var overriddenSymbols: List<S> var overriddenSymbols: List<S>
} }
@@ -16,5 +16,5 @@ import org.jetbrains.kotlin.descriptors.Modality
*/ */
interface IrOverridableMember : IrDeclaration, IrDeclarationWithVisibility, interface IrOverridableMember : IrDeclaration, IrDeclarationWithVisibility,
IrDeclarationWithName, IrSymbolOwner { IrDeclarationWithName, IrSymbolOwner {
val modality: Modality var modality: Modality
} }
@@ -24,5 +24,5 @@ abstract class IrPackageFragment : IrElementBase(), IrDeclarationContainer, IrSy
@ObsoleteDescriptorBasedAPI @ObsoleteDescriptorBasedAPI
abstract val packageFragmentDescriptor: PackageFragmentDescriptor abstract val packageFragmentDescriptor: PackageFragmentDescriptor
abstract val fqName: FqName abstract var fqName: FqName
} }
@@ -14,5 +14,5 @@ package org.jetbrains.kotlin.ir.declarations
* @sample org.jetbrains.kotlin.ir.generator.IrTree.possiblyExternalDeclaration * @sample org.jetbrains.kotlin.ir.generator.IrTree.possiblyExternalDeclaration
*/ */
interface IrPossiblyExternalDeclaration : IrDeclarationWithName { interface IrPossiblyExternalDeclaration : IrDeclarationWithName {
val isExternal: Boolean var isExternal: Boolean
} }
@@ -26,17 +26,17 @@ abstract class IrProperty : IrDeclarationBase(), IrPossiblyExternalDeclaration,
abstract override val symbol: IrPropertySymbol abstract override val symbol: IrPropertySymbol
abstract val isVar: Boolean abstract var isVar: Boolean
abstract val isConst: Boolean abstract var isConst: Boolean
abstract val isLateinit: Boolean abstract var isLateinit: Boolean
abstract val isDelegated: Boolean abstract var isDelegated: Boolean
abstract val isExpect: Boolean abstract var isExpect: Boolean
abstract override val isFakeOverride: Boolean abstract override var isFakeOverride: Boolean
abstract var backingField: IrField? abstract var backingField: IrField?
@@ -20,15 +20,15 @@ abstract class IrSimpleFunction : IrFunction(),
IrOverridableDeclaration<IrSimpleFunctionSymbol>, IrAttributeContainer { IrOverridableDeclaration<IrSimpleFunctionSymbol>, IrAttributeContainer {
abstract override val symbol: IrSimpleFunctionSymbol abstract override val symbol: IrSimpleFunctionSymbol
abstract val isTailrec: Boolean abstract var isTailrec: Boolean
abstract val isSuspend: Boolean abstract var isSuspend: Boolean
abstract override val isFakeOverride: Boolean abstract override var isFakeOverride: Boolean
abstract val isOperator: Boolean abstract var isOperator: Boolean
abstract val isInfix: Boolean abstract var isInfix: Boolean
abstract var correspondingPropertySymbol: IrPropertySymbol? abstract var correspondingPropertySymbol: IrPropertySymbol?
@@ -27,7 +27,7 @@ abstract class IrTypeAlias : IrDeclarationBase(), IrDeclarationWithName,
abstract override val symbol: IrTypeAliasSymbol abstract override val symbol: IrTypeAliasSymbol
abstract val isActual: Boolean abstract var isActual: Boolean
abstract var expandedType: IrType abstract var expandedType: IrType
@@ -26,11 +26,11 @@ abstract class IrTypeParameter : IrDeclarationBase(), IrDeclarationWithName {
abstract override val symbol: IrTypeParameterSymbol abstract override val symbol: IrTypeParameterSymbol
abstract val variance: Variance abstract var variance: Variance
abstract val index: Int abstract var index: Int
abstract val isReified: Boolean abstract var isReified: Boolean
abstract var superTypes: List<IrType> abstract var superTypes: List<IrType>
@@ -26,15 +26,15 @@ abstract class IrValueParameter : IrDeclarationBase(), IrValueDeclaration {
abstract override val symbol: IrValueParameterSymbol abstract override val symbol: IrValueParameterSymbol
abstract val index: Int abstract var index: Int
abstract var varargElementType: IrType? abstract var varargElementType: IrType?
abstract val isCrossinline: Boolean abstract var isCrossinline: Boolean
abstract val isNoinline: Boolean abstract var isNoinline: Boolean
abstract val isHidden: Boolean abstract var isHidden: Boolean
abstract var defaultValue: IrExpressionBody? abstract var defaultValue: IrExpressionBody?
@@ -25,11 +25,11 @@ abstract class IrVariable : IrDeclarationBase(), IrValueDeclaration {
abstract override val symbol: IrVariableSymbol abstract override val symbol: IrVariableSymbol
abstract val isVar: Boolean abstract var isVar: Boolean
abstract val isConst: Boolean abstract var isConst: Boolean
abstract val isLateinit: Boolean abstract var isLateinit: Boolean
abstract var initializer: IrExpression? abstract var initializer: IrExpression?
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
abstract class IrCall : IrFunctionAccessExpression() { abstract class IrCall : IrFunctionAccessExpression() {
abstract override val symbol: IrSimpleFunctionSymbol abstract override val symbol: IrSimpleFunctionSymbol
abstract val superQualifierSymbol: IrClassSymbol? abstract var superQualifierSymbol: IrClassSymbol?
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitCall(this, data) visitor.visitCall(this, data)
@@ -15,9 +15,9 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.const * @sample org.jetbrains.kotlin.ir.generator.IrTree.const
*/ */
abstract class IrConst<T> : IrExpression() { abstract class IrConst<T> : IrExpression() {
abstract val kind: IrConstKind<T> abstract var kind: IrConstKind<T>
abstract val value: T abstract var value: T
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitConst(this, data) visitor.visitConst(this, data)
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.constantObject * @sample org.jetbrains.kotlin.ir.generator.IrTree.constantObject
*/ */
abstract class IrConstantObject : IrConstantValue() { abstract class IrConstantObject : IrConstantValue() {
abstract val constructor: IrConstructorSymbol abstract var constructor: IrConstructorSymbol
abstract val valueArguments: MutableList<IrConstantValue> abstract val valueArguments: MutableList<IrConstantValue>
@@ -19,9 +19,9 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
abstract class IrConstructorCall : IrFunctionAccessExpression() { abstract class IrConstructorCall : IrFunctionAccessExpression() {
abstract override val symbol: IrConstructorSymbol abstract override val symbol: IrConstructorSymbol
abstract val source: SourceElement abstract var source: SourceElement
abstract val constructorTypeArgumentsCount: Int abstract var constructorTypeArgumentsCount: Int
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitConstructorCall(this, data) visitor.visitConstructorCall(this, data)
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.containerExpression * @sample org.jetbrains.kotlin.ir.generator.IrTree.containerExpression
*/ */
abstract class IrContainerExpression : IrExpression(), IrStatementContainer { abstract class IrContainerExpression : IrExpression(), IrStatementContainer {
abstract val origin: IrStatementOrigin? abstract var origin: IrStatementOrigin?
override val statements: MutableList<IrStatement> = ArrayList(2) override val statements: MutableList<IrStatement> = ArrayList(2)
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.dynamicMemberExpression * @sample org.jetbrains.kotlin.ir.generator.IrTree.dynamicMemberExpression
*/ */
abstract class IrDynamicMemberExpression : IrDynamicExpression() { abstract class IrDynamicMemberExpression : IrDynamicExpression() {
abstract val memberName: String abstract var memberName: String
abstract var receiver: IrExpression abstract var receiver: IrExpression
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.dynamicOperatorExpression * @sample org.jetbrains.kotlin.ir.generator.IrTree.dynamicOperatorExpression
*/ */
abstract class IrDynamicOperatorExpression : IrDynamicExpression() { abstract class IrDynamicOperatorExpression : IrDynamicExpression() {
abstract val operator: IrDynamicOperator abstract var operator: IrDynamicOperator
abstract var receiver: IrExpression abstract var receiver: IrExpression
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.errorExpression * @sample org.jetbrains.kotlin.ir.generator.IrTree.errorExpression
*/ */
abstract class IrErrorExpression : IrExpression() { abstract class IrErrorExpression : IrExpression() {
abstract val description: String abstract var description: String
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitErrorExpression(this, data) visitor.visitErrorExpression(this, data)
@@ -18,9 +18,9 @@ import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
abstract class IrFieldAccessExpression : IrDeclarationReference() { abstract class IrFieldAccessExpression : IrDeclarationReference() {
abstract override val symbol: IrFieldSymbol abstract override val symbol: IrFieldSymbol
abstract val superQualifierSymbol: IrClassSymbol? abstract var superQualifierSymbol: IrClassSymbol?
var receiver: IrExpression? = null var receiver: IrExpression? = null
abstract val origin: IrStatementOrigin? abstract var origin: IrStatementOrigin?
} }
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.functionExpression * @sample org.jetbrains.kotlin.ir.generator.IrTree.functionExpression
*/ */
abstract class IrFunctionExpression : IrExpression() { abstract class IrFunctionExpression : IrExpression() {
abstract val origin: IrStatementOrigin abstract var origin: IrStatementOrigin
abstract var function: IrSimpleFunction abstract var function: IrSimpleFunction
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.functionReference * @sample org.jetbrains.kotlin.ir.generator.IrTree.functionReference
*/ */
abstract class IrFunctionReference : IrCallableReference<IrFunctionSymbol>() { abstract class IrFunctionReference : IrCallableReference<IrFunctionSymbol>() {
abstract val reflectionTarget: IrFunctionSymbol? abstract var reflectionTarget: IrFunctionSymbol?
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitFunctionReference(this, data) visitor.visitFunctionReference(this, data)
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.instanceInitializerCall * @sample org.jetbrains.kotlin.ir.generator.IrTree.instanceInitializerCall
*/ */
abstract class IrInstanceInitializerCall : IrExpression() { abstract class IrInstanceInitializerCall : IrExpression() {
abstract val classSymbol: IrClassSymbol abstract var classSymbol: IrClassSymbol
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitInstanceInitializerCall(this, data) visitor.visitInstanceInitializerCall(this, data)
@@ -19,11 +19,11 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
*/ */
abstract class IrLocalDelegatedPropertyReference : abstract class IrLocalDelegatedPropertyReference :
IrCallableReference<IrLocalDelegatedPropertySymbol>() { IrCallableReference<IrLocalDelegatedPropertySymbol>() {
abstract val delegate: IrVariableSymbol abstract var delegate: IrVariableSymbol
abstract val getter: IrSimpleFunctionSymbol abstract var getter: IrSimpleFunctionSymbol
abstract val setter: IrSimpleFunctionSymbol? abstract var setter: IrSimpleFunctionSymbol?
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitLocalDelegatedPropertyReference(this, data) visitor.visitLocalDelegatedPropertyReference(this, data)
@@ -14,7 +14,7 @@ package org.jetbrains.kotlin.ir.expressions
* @sample org.jetbrains.kotlin.ir.generator.IrTree.loop * @sample org.jetbrains.kotlin.ir.generator.IrTree.loop
*/ */
abstract class IrLoop : IrExpression() { abstract class IrLoop : IrExpression() {
abstract val origin: IrStatementOrigin? abstract var origin: IrStatementOrigin?
var body: IrExpression? = null var body: IrExpression? = null
@@ -18,11 +18,11 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.propertyReference * @sample org.jetbrains.kotlin.ir.generator.IrTree.propertyReference
*/ */
abstract class IrPropertyReference : IrCallableReference<IrPropertySymbol>() { abstract class IrPropertyReference : IrCallableReference<IrPropertySymbol>() {
abstract val field: IrFieldSymbol? abstract var field: IrFieldSymbol?
abstract val getter: IrSimpleFunctionSymbol? abstract var getter: IrSimpleFunctionSymbol?
abstract val setter: IrSimpleFunctionSymbol? abstract var setter: IrSimpleFunctionSymbol?
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitPropertyReference(this, data) visitor.visitPropertyReference(this, data)
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
abstract class IrReturn : IrExpression() { abstract class IrReturn : IrExpression() {
abstract var value: IrExpression abstract var value: IrExpression
abstract val returnTargetSymbol: IrReturnTargetSymbol abstract var returnTargetSymbol: IrReturnTargetSymbol
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitReturn(this, data) visitor.visitReturn(this, data)
@@ -20,5 +20,5 @@ import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol
abstract class IrReturnableBlock : IrBlock(), IrSymbolOwner, IrReturnTarget { abstract class IrReturnableBlock : IrBlock(), IrSymbolOwner, IrReturnTarget {
abstract override val symbol: IrReturnableBlockSymbol abstract override val symbol: IrReturnableBlockSymbol
abstract val inlineFunctionSymbol: IrFunctionSymbol? abstract var inlineFunctionSymbol: IrFunctionSymbol?
} }
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.syntheticBody * @sample org.jetbrains.kotlin.ir.generator.IrTree.syntheticBody
*/ */
abstract class IrSyntheticBody : IrBody() { abstract class IrSyntheticBody : IrBody() {
abstract val kind: IrSyntheticBodyKind abstract var kind: IrSyntheticBodyKind
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R = override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitSyntheticBody(this, data) visitor.visitSyntheticBody(this, data)
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.typeOperatorCall * @sample org.jetbrains.kotlin.ir.generator.IrTree.typeOperatorCall
*/ */
abstract class IrTypeOperatorCall : IrExpression() { abstract class IrTypeOperatorCall : IrExpression() {
abstract val operator: IrTypeOperator abstract var operator: IrTypeOperator
abstract var argument: IrExpression abstract var argument: IrExpression
@@ -17,5 +17,5 @@ import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
abstract class IrValueAccessExpression : IrDeclarationReference() { abstract class IrValueAccessExpression : IrDeclarationReference() {
abstract override val symbol: IrValueSymbol abstract override val symbol: IrValueSymbol
abstract val origin: IrStatementOrigin? abstract var origin: IrStatementOrigin?
} }
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
* @sample org.jetbrains.kotlin.ir.generator.IrTree.when * @sample org.jetbrains.kotlin.ir.generator.IrTree.when
*/ */
abstract class IrWhen : IrExpression() { abstract class IrWhen : IrExpression() {
abstract val origin: IrStatementOrigin? abstract var origin: IrStatementOrigin?
abstract val branches: MutableList<IrBranch> abstract val branches: MutableList<IrBranch>
@@ -20,7 +20,7 @@ class IrAnonymousInitializerImpl(
override val endOffset: Int, override val endOffset: Int,
override var origin: IrDeclarationOrigin, override var origin: IrDeclarationOrigin,
override val symbol: IrAnonymousInitializerSymbol, override val symbol: IrAnonymousInitializerSymbol,
override val isStatic: Boolean = false, override var isStatic: Boolean = false,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrAnonymousInitializer() { ) : IrAnonymousInitializer() {
init { init {
@@ -20,16 +20,16 @@ open class IrClassImpl(
override var origin: IrDeclarationOrigin, override var origin: IrDeclarationOrigin,
final override val symbol: IrClassSymbol, final override val symbol: IrClassSymbol,
override var name: Name, override var name: Name,
override val kind: ClassKind, override var kind: ClassKind,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override var modality: Modality, override var modality: Modality,
override val isCompanion: Boolean = false, override var isCompanion: Boolean = false,
override var isInner: Boolean = false, override var isInner: Boolean = false,
override val isData: Boolean = false, override var isData: Boolean = false,
override val isExternal: Boolean = false, override var isExternal: Boolean = false,
override val isValue: Boolean = false, override var isValue: Boolean = false,
override val isExpect: Boolean = false, override var isExpect: Boolean = false,
override val isFun: Boolean = false, override var isFun: Boolean = false,
override val source: SourceElement = SourceElement.NO_SOURCE, override val source: SourceElement = SourceElement.NO_SOURCE,
override val factory: IrFactory = IrFactoryImpl override val factory: IrFactory = IrFactoryImpl
) : IrClass() { ) : IrClass() {
@@ -26,11 +26,11 @@ class IrConstructorImpl(
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
returnType: IrType, returnType: IrType,
override val isInline: Boolean, override var isInline: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isPrimary: Boolean, override var isPrimary: Boolean,
override val isExpect: Boolean, override var isExpect: Boolean,
override val containerSource: DeserializedContainerSource? = null, override var containerSource: DeserializedContainerSource? = null,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrConstructor() { ) : IrConstructor() {
init { init {
@@ -31,7 +31,7 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.Deserializ
class IrExternalPackageFragmentImpl( class IrExternalPackageFragmentImpl(
override val symbol: IrExternalPackageFragmentSymbol, override val symbol: IrExternalPackageFragmentSymbol,
override val fqName: FqName override var fqName: FqName
) : IrExternalPackageFragment() { ) : IrExternalPackageFragment() {
override val startOffset: Int override val startOffset: Int
get() = UNDEFINED_OFFSET get() = UNDEFINED_OFFSET
@@ -24,9 +24,9 @@ class IrFieldImpl(
override var name: Name, override var name: Name,
override var type: IrType, override var type: IrType,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override val isFinal: Boolean, override var isFinal: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isStatic: Boolean, override var isStatic: Boolean,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrField() { ) : IrField() {
init { init {
@@ -29,9 +29,9 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrFileSymbolImpl
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
class IrFileImpl( class IrFileImpl(
override val fileEntry: IrFileEntry, override var fileEntry: IrFileEntry,
override val symbol: IrFileSymbol, override val symbol: IrFileSymbol,
override val fqName: FqName override var fqName: FqName
) : IrFile() { ) : IrFile() {
constructor( constructor(
fileEntry: IrFileEntry, fileEntry: IrFileEntry,
@@ -28,14 +28,14 @@ abstract class IrFunctionCommonImpl(
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
returnType: IrType, returnType: IrType,
override val isInline: Boolean, override var isInline: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isTailrec: Boolean, override var isTailrec: Boolean,
override val isSuspend: Boolean, override var isSuspend: Boolean,
override val isOperator: Boolean, override var isOperator: Boolean,
override val isInfix: Boolean, override var isInfix: Boolean,
override val isExpect: Boolean, override var isExpect: Boolean,
override val containerSource: DeserializedContainerSource?, override var containerSource: DeserializedContainerSource?,
) : IrSimpleFunction() { ) : IrSimpleFunction() {
override lateinit var parent: IrDeclarationParent override lateinit var parent: IrDeclarationParent
@@ -75,7 +75,7 @@ class IrFunctionImpl(
override val symbol: IrSimpleFunctionSymbol, override val symbol: IrSimpleFunctionSymbol,
name: Name, name: Name,
visibility: DescriptorVisibility, visibility: DescriptorVisibility,
override val modality: Modality, override var modality: Modality,
returnType: IrType, returnType: IrType,
isInline: Boolean, isInline: Boolean,
isExternal: Boolean, isExternal: Boolean,
@@ -84,7 +84,7 @@ class IrFunctionImpl(
isOperator: Boolean, isOperator: Boolean,
isInfix: Boolean, isInfix: Boolean,
isExpect: Boolean, isExpect: Boolean,
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE, override var isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
containerSource: DeserializedContainerSource? = null, containerSource: DeserializedContainerSource? = null,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrFunctionCommonImpl( ) : IrFunctionCommonImpl(
@@ -116,7 +116,7 @@ class IrFunctionWithLateBindingImpl(
isOperator: Boolean, isOperator: Boolean,
isInfix: Boolean, isInfix: Boolean,
isExpect: Boolean, isExpect: Boolean,
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE, override var isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
override val factory: IrFactory = IrFactoryImpl override val factory: IrFactory = IrFactoryImpl
) : IrFunctionCommonImpl( ) : IrFunctionCommonImpl(
startOffset, endOffset, origin, name, visibility, returnType, isInline, startOffset, endOffset, origin, name, visibility, returnType, isInline,
@@ -20,7 +20,7 @@ class IrLocalDelegatedPropertyImpl(
override val symbol: IrLocalDelegatedPropertySymbol, override val symbol: IrLocalDelegatedPropertySymbol,
override var name: Name, override var name: Name,
override var type: IrType, override var type: IrType,
override val isVar: Boolean, override var isVar: Boolean,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrLocalDelegatedProperty() { ) : IrLocalDelegatedProperty() {
init { init {
@@ -5,9 +5,9 @@
package org.jetbrains.kotlin.ir.declarations.impl package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
@@ -22,12 +22,12 @@ abstract class IrPropertyCommonImpl(
override var origin: IrDeclarationOrigin, override var origin: IrDeclarationOrigin,
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override val isVar: Boolean, override var isVar: Boolean,
override val isConst: Boolean, override var isConst: Boolean,
override val isLateinit: Boolean, override var isLateinit: Boolean,
override val isDelegated: Boolean, override var isDelegated: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isExpect: Boolean, override var isExpect: Boolean,
override val containerSource: DeserializedContainerSource?, override val containerSource: DeserializedContainerSource?,
) : IrProperty() { ) : IrProperty() {
@@ -54,14 +54,14 @@ class IrPropertyImpl(
override val symbol: IrPropertySymbol, override val symbol: IrPropertySymbol,
name: Name, name: Name,
visibility: DescriptorVisibility, visibility: DescriptorVisibility,
override val modality: Modality, override var modality: Modality,
isVar: Boolean, isVar: Boolean,
isConst: Boolean, isConst: Boolean,
isLateinit: Boolean, isLateinit: Boolean,
isDelegated: Boolean, isDelegated: Boolean,
isExternal: Boolean, isExternal: Boolean,
isExpect: Boolean = false, isExpect: Boolean = false,
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE, override var isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
containerSource: DeserializedContainerSource? = null, containerSource: DeserializedContainerSource? = null,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrPropertyCommonImpl( ) : IrPropertyCommonImpl(
@@ -90,7 +90,7 @@ class IrPropertyWithLateBindingImpl(
isDelegated: Boolean, isDelegated: Boolean,
isExternal: Boolean, isExternal: Boolean,
isExpect: Boolean, isExpect: Boolean,
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE, override var isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrPropertyCommonImpl( ) : IrPropertyCommonImpl(
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
@@ -21,7 +21,7 @@ class IrTypeAliasImpl(
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override var expandedType: IrType, override var expandedType: IrType,
override val isActual: Boolean, override var isActual: Boolean,
override var origin: IrDeclarationOrigin, override var origin: IrDeclarationOrigin,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrTypeAlias() { ) : IrTypeAlias() {
@@ -23,9 +23,9 @@ class IrTypeParameterImpl(
override var origin: IrDeclarationOrigin, override var origin: IrDeclarationOrigin,
override val symbol: IrTypeParameterSymbol, override val symbol: IrTypeParameterSymbol,
override var name: Name, override var name: Name,
override val index: Int, override var index: Int,
override val isReified: Boolean, override var isReified: Boolean,
override val variance: Variance, override var variance: Variance,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrTypeParameter() { ) : IrTypeParameter() {
init { init {
@@ -23,12 +23,12 @@ class IrValueParameterImpl(
override var origin: IrDeclarationOrigin, override var origin: IrDeclarationOrigin,
override val symbol: IrValueParameterSymbol, override val symbol: IrValueParameterSymbol,
override var name: Name, override var name: Name,
override val index: Int, override var index: Int,
override var type: IrType, override var type: IrType,
override var varargElementType: IrType?, override var varargElementType: IrType?,
override val isCrossinline: Boolean, override var isCrossinline: Boolean,
override val isNoinline: Boolean, override var isNoinline: Boolean,
override val isHidden: Boolean, override var isHidden: Boolean,
override val isAssignable: Boolean, override val isAssignable: Boolean,
override val factory: IrFactory = IrFactoryImpl, override val factory: IrFactory = IrFactoryImpl,
) : IrValueParameter() { ) : IrValueParameter() {
@@ -35,9 +35,9 @@ class IrVariableImpl(
override val symbol: IrVariableSymbol, override val symbol: IrVariableSymbol,
override var name: Name, override var name: Name,
override var type: IrType, override var type: IrType,
override val isVar: Boolean, override var isVar: Boolean,
override val isConst: Boolean, override var isConst: Boolean,
override val isLateinit: Boolean override var isLateinit: Boolean
) : IrVariable() { ) : IrVariable() {
private var _parent: IrDeclarationParent? = null private var _parent: IrDeclarationParent? = null
override var parent: IrDeclarationParent override var parent: IrDeclarationParent
@@ -27,16 +27,16 @@ class IrLazyClass(
@OptIn(ObsoleteDescriptorBasedAPI::class) @OptIn(ObsoleteDescriptorBasedAPI::class)
override val descriptor: ClassDescriptor, override val descriptor: ClassDescriptor,
override var name: Name, override var name: Name,
override val kind: ClassKind, override var kind: ClassKind,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override var modality: Modality, override var modality: Modality,
override val isCompanion: Boolean, override var isCompanion: Boolean,
override val isInner: Boolean, override var isInner: Boolean,
override val isData: Boolean, override var isData: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isValue: Boolean, override var isValue: Boolean,
override val isExpect: Boolean, override var isExpect: Boolean,
override val isFun: Boolean, override var isFun: Boolean,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator override val typeTranslator: TypeTranslator
) : IrClass(), IrLazyDeclarationBase, DeserializableClass { ) : IrClass(), IrLazyDeclarationBase, DeserializableClass {
@@ -29,10 +29,10 @@ class IrLazyConstructor(
override val descriptor: ClassConstructorDescriptor, override val descriptor: ClassConstructorDescriptor,
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override val isInline: Boolean, override var isInline: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isPrimary: Boolean, override var isPrimary: Boolean,
override val isExpect: Boolean, override var isExpect: Boolean,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator, override val typeTranslator: TypeTranslator,
) : IrConstructor(), IrLazyFunctionBase { ) : IrConstructor(), IrLazyFunctionBase {
@@ -31,9 +31,9 @@ class IrLazyField(
override val descriptor: PropertyDescriptor, override val descriptor: PropertyDescriptor,
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override val isFinal: Boolean, override var isFinal: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isStatic: Boolean, override var isStatic: Boolean,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator, override val typeTranslator: TypeTranslator,
) : IrField(), IrLazyDeclarationBase { ) : IrField(), IrLazyDeclarationBase {
@@ -33,15 +33,15 @@ class IrLazyFunction(
override val descriptor: FunctionDescriptor, override val descriptor: FunctionDescriptor,
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override val modality: Modality, override var modality: Modality,
override val isInline: Boolean, override var isInline: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isTailrec: Boolean, override var isTailrec: Boolean,
override val isSuspend: Boolean, override var isSuspend: Boolean,
override val isExpect: Boolean, override var isExpect: Boolean,
override val isFakeOverride: Boolean, override var isFakeOverride: Boolean,
override val isOperator: Boolean, override var isOperator: Boolean,
override val isInfix: Boolean, override var isInfix: Boolean,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator, override val typeTranslator: TypeTranslator,
) : IrSimpleFunction(), IrLazyFunctionBase { ) : IrSimpleFunction(), IrLazyFunctionBase {
@@ -129,4 +129,3 @@ class IrLazyFunction(
symbol.bind(this) symbol.bind(this)
} }
} }
@@ -27,14 +27,14 @@ class IrLazyProperty(
override val descriptor: PropertyDescriptor, override val descriptor: PropertyDescriptor,
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override val modality: Modality, override var modality: Modality,
override val isVar: Boolean, override var isVar: Boolean,
override val isConst: Boolean, override var isConst: Boolean,
override val isLateinit: Boolean, override var isLateinit: Boolean,
override val isDelegated: Boolean, override var isDelegated: Boolean,
override val isExternal: Boolean, override var isExternal: Boolean,
override val isExpect: Boolean, override var isExpect: Boolean,
override val isFakeOverride: Boolean, override var isFakeOverride: Boolean,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator, override val typeTranslator: TypeTranslator,
) : IrProperty(), IrLazyDeclarationBase { ) : IrProperty(), IrLazyDeclarationBase {
@@ -25,7 +25,7 @@ class IrLazyTypeAlias(
override val descriptor: TypeAliasDescriptor, override val descriptor: TypeAliasDescriptor,
override var name: Name, override var name: Name,
override var visibility: DescriptorVisibility, override var visibility: DescriptorVisibility,
override val isActual: Boolean, override var isActual: Boolean,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator, override val typeTranslator: TypeTranslator,
) : IrTypeAlias(), IrLazyDeclarationBase { ) : IrTypeAlias(), IrLazyDeclarationBase {
@@ -24,9 +24,9 @@ class IrLazyTypeParameter(
override val symbol: IrTypeParameterSymbol, override val symbol: IrTypeParameterSymbol,
override val descriptor: TypeParameterDescriptor, override val descriptor: TypeParameterDescriptor,
override var name: Name, override var name: Name,
override val index: Int, override var index: Int,
override val isReified: Boolean, override var isReified: Boolean,
override val variance: Variance, override var variance: Variance,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator, override val typeTranslator: TypeTranslator,
) : IrTypeParameter(), IrLazyDeclarationBase { ) : IrTypeParameter(), IrLazyDeclarationBase {
@@ -27,12 +27,12 @@ class IrLazyValueParameter(
override val symbol: IrValueParameterSymbol, override val symbol: IrValueParameterSymbol,
override val descriptor: ValueParameterDescriptor, override val descriptor: ValueParameterDescriptor,
override var name: Name, override var name: Name,
override val index: Int, override var index: Int,
kotlinType: KotlinType, kotlinType: KotlinType,
varargElementKotlinType: KotlinType?, varargElementKotlinType: KotlinType?,
override val isCrossinline: Boolean, override var isCrossinline: Boolean,
override val isNoinline: Boolean, override var isNoinline: Boolean,
override val isHidden: Boolean, override var isHidden: Boolean,
override val isAssignable: Boolean, override val isAssignable: Boolean,
override val stubGenerator: DeclarationStubGenerator, override val stubGenerator: DeclarationStubGenerator,
override val typeTranslator: TypeTranslator, override val typeTranslator: TypeTranslator,
@@ -30,7 +30,7 @@ class IrBlockImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin? = null, override var origin: IrStatementOrigin? = null,
) : IrBlock() { ) : IrBlock() {
constructor( constructor(
startOffset: Int, startOffset: Int,
@@ -60,8 +60,8 @@ class IrReturnableBlockImpl(
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val symbol: IrReturnableBlockSymbol, override val symbol: IrReturnableBlockSymbol,
override val origin: IrStatementOrigin? = null, override var origin: IrStatementOrigin? = null,
override val inlineFunctionSymbol: IrFunctionSymbol? = null override var inlineFunctionSymbol: IrFunctionSymbol? = null
) : IrReturnableBlock() { ) : IrReturnableBlock() {
@ObsoleteDescriptorBasedAPI @ObsoleteDescriptorBasedAPI
override val descriptor: FunctionDescriptor override val descriptor: FunctionDescriptor
@@ -35,7 +35,7 @@ class IrCallImpl(
typeArgumentsCount: Int, typeArgumentsCount: Int,
valueArgumentsCount: Int, valueArgumentsCount: Int,
override val origin: IrStatementOrigin? = null, override val origin: IrStatementOrigin? = null,
override val superQualifierSymbol: IrClassSymbol? = null override var superQualifierSymbol: IrClassSymbol? = null
) : IrCall() { ) : IrCall() {
override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount) override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount)
@@ -25,7 +25,7 @@ class IrCompositeImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin? = null, override var origin: IrStatementOrigin? = null,
) : IrComposite() { ) : IrComposite() {
constructor( constructor(
startOffset: Int, startOffset: Int,
@@ -28,8 +28,8 @@ class IrConstImpl<T>(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val kind: IrConstKind<T>, override var kind: IrConstKind<T>,
override val value: T override var value: T
) : IrConst<T>() { ) : IrConst<T>() {
companion object { companion object {
fun string(startOffset: Int, endOffset: Int, type: IrType, value: String): IrConstImpl<String> = fun string(startOffset: Int, endOffset: Int, type: IrType, value: String): IrConstImpl<String> =
@@ -37,7 +37,7 @@ class IrConstantPrimitiveImpl(
class IrConstantObjectImpl constructor( class IrConstantObjectImpl constructor(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override val constructor: IrConstructorSymbol, override var constructor: IrConstructorSymbol,
initArguments: List<IrConstantValue>, initArguments: List<IrConstantValue>,
override val typeArguments: List<IrType>, override val typeArguments: List<IrType>,
override var type: IrType = constructor.owner.constructedClassType, override var type: IrType = constructor.owner.constructedClassType,
@@ -21,10 +21,10 @@ class IrConstructorCallImpl(
override var type: IrType, override var type: IrType,
override val symbol: IrConstructorSymbol, override val symbol: IrConstructorSymbol,
typeArgumentsCount: Int, typeArgumentsCount: Int,
override val constructorTypeArgumentsCount: Int, override var constructorTypeArgumentsCount: Int,
valueArgumentsCount: Int, valueArgumentsCount: Int,
override val origin: IrStatementOrigin? = null, override val origin: IrStatementOrigin? = null,
override val source: SourceElement = SourceElement.NO_SOURCE override var source: SourceElement = SourceElement.NO_SOURCE
) : IrConstructorCall() { ) : IrConstructorCall() {
override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount) override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount)
@@ -25,7 +25,7 @@ class IrDoWhileLoopImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin?, override var origin: IrStatementOrigin?,
) : IrDoWhileLoop() { ) : IrDoWhileLoop() {
override lateinit var condition: IrExpression override lateinit var condition: IrExpression
} }
@@ -13,6 +13,6 @@ class IrDynamicMemberExpressionImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val memberName: String, override var memberName: String,
override var receiver: IrExpression override var receiver: IrExpression
) : IrDynamicMemberExpression() ) : IrDynamicMemberExpression()
@@ -15,7 +15,7 @@ class IrDynamicOperatorExpressionImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val operator: IrDynamicOperator override var operator: IrDynamicOperator
) : IrDynamicOperatorExpression() { ) : IrDynamicOperatorExpression() {
override lateinit var receiver: IrExpression override lateinit var receiver: IrExpression
@@ -25,7 +25,7 @@ class IrErrorCallExpressionImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val description: String override var description: String
) : IrErrorCallExpression() { ) : IrErrorCallExpression() {
override var explicitReceiver: IrExpression? = null override var explicitReceiver: IrExpression? = null
override val arguments: MutableList<IrExpression> = SmartList() override val arguments: MutableList<IrExpression> = SmartList()
@@ -23,5 +23,5 @@ class IrErrorExpressionImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val description: String override var description: String
) : IrErrorExpression() ) : IrErrorExpression()
@@ -15,5 +15,5 @@ class IrFunctionExpressionImpl(
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override var function: IrSimpleFunction, override var function: IrSimpleFunction,
override val origin: IrStatementOrigin override var origin: IrStatementOrigin
) : IrFunctionExpression() ) : IrFunctionExpression()
@@ -30,7 +30,7 @@ class IrFunctionReferenceImpl(
override val symbol: IrFunctionSymbol, override val symbol: IrFunctionSymbol,
typeArgumentsCount: Int, typeArgumentsCount: Int,
valueArgumentsCount: Int, valueArgumentsCount: Int,
override val reflectionTarget: IrFunctionSymbol? = symbol, override var reflectionTarget: IrFunctionSymbol? = symbol,
override val origin: IrStatementOrigin? = null, override val origin: IrStatementOrigin? = null,
) : IrFunctionReference() { ) : IrFunctionReference() {
override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount) override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount)
@@ -28,8 +28,8 @@ class IrGetFieldImpl(
override val endOffset: Int, override val endOffset: Int,
override val symbol: IrFieldSymbol, override val symbol: IrFieldSymbol,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin? = null, override var origin: IrStatementOrigin? = null,
override val superQualifierSymbol: IrClassSymbol? = null, override var superQualifierSymbol: IrClassSymbol? = null,
) : IrGetField() { ) : IrGetField() {
constructor( constructor(
startOffset: Int, endOffset: Int, startOffset: Int, endOffset: Int,
@@ -15,7 +15,7 @@ class IrGetValueImpl(
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val symbol: IrValueSymbol, override val symbol: IrValueSymbol,
override val origin: IrStatementOrigin? = null override var origin: IrStatementOrigin? = null
) : IrGetValue() { ) : IrGetValue() {
constructor( constructor(
startOffset: Int, startOffset: Int,
@@ -26,7 +26,7 @@ class IrIfThenElseImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin? = null override var origin: IrStatementOrigin? = null
) : IrWhen() { ) : IrWhen() {
override val branches: MutableList<IrBranch> = SmartList() override val branches: MutableList<IrBranch> = SmartList()
} }
@@ -23,6 +23,6 @@ import org.jetbrains.kotlin.ir.types.IrType
class IrInstanceInitializerCallImpl( class IrInstanceInitializerCallImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override val classSymbol: IrClassSymbol, override var classSymbol: IrClassSymbol,
override var type: IrType, override var type: IrType,
) : IrInstanceInitializerCall() ) : IrInstanceInitializerCall()
@@ -29,9 +29,9 @@ class IrLocalDelegatedPropertyReferenceImpl(
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val symbol: IrLocalDelegatedPropertySymbol, override val symbol: IrLocalDelegatedPropertySymbol,
override val delegate: IrVariableSymbol, override var delegate: IrVariableSymbol,
override val getter: IrSimpleFunctionSymbol, override var getter: IrSimpleFunctionSymbol,
override val setter: IrSimpleFunctionSymbol?, override var setter: IrSimpleFunctionSymbol?,
override val origin: IrStatementOrigin? = null, override val origin: IrStatementOrigin? = null,
) : IrLocalDelegatedPropertyReference() { ) : IrLocalDelegatedPropertyReference() {
override val typeArgumentsByIndex: Array<IrType?> = emptyArray() override val typeArgumentsByIndex: Array<IrType?> = emptyArray()
@@ -30,9 +30,9 @@ class IrPropertyReferenceImpl(
override var type: IrType, override var type: IrType,
override val symbol: IrPropertySymbol, override val symbol: IrPropertySymbol,
typeArgumentsCount: Int, typeArgumentsCount: Int,
override val field: IrFieldSymbol?, override var field: IrFieldSymbol?,
override val getter: IrSimpleFunctionSymbol?, override var getter: IrSimpleFunctionSymbol?,
override val setter: IrSimpleFunctionSymbol?, override var setter: IrSimpleFunctionSymbol?,
override val origin: IrStatementOrigin? = null, override val origin: IrStatementOrigin? = null,
) : IrPropertyReference() { ) : IrPropertyReference() {
override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount) override val typeArgumentsByIndex: Array<IrType?> = arrayOfNulls(typeArgumentsCount)
@@ -25,6 +25,6 @@ class IrReturnImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val returnTargetSymbol: IrReturnTargetSymbol, override var returnTargetSymbol: IrReturnTargetSymbol,
override var value: IrExpression override var value: IrExpression
) : IrReturn() ) : IrReturn()
@@ -28,8 +28,8 @@ class IrSetFieldImpl(
override val endOffset: Int, override val endOffset: Int,
override val symbol: IrFieldSymbol, override val symbol: IrFieldSymbol,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin? = null, override var origin: IrStatementOrigin? = null,
override val superQualifierSymbol: IrClassSymbol? = null, override var superQualifierSymbol: IrClassSymbol? = null,
) : IrSetField() { ) : IrSetField() {
constructor( constructor(
startOffset: Int, endOffset: Int, startOffset: Int, endOffset: Int,
@@ -28,7 +28,7 @@ class IrSetValueImpl(
override var type: IrType, override var type: IrType,
override val symbol: IrValueSymbol, override val symbol: IrValueSymbol,
override var value: IrExpression, override var value: IrExpression,
override val origin: IrStatementOrigin? override var origin: IrStatementOrigin?
) : IrSetValue() { ) : IrSetValue() {
init { init {
if (symbol.isBound) { if (symbol.isBound) {
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
class IrSyntheticBodyImpl( class IrSyntheticBodyImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override val kind: IrSyntheticBodyKind override var kind: IrSyntheticBodyKind
) : IrSyntheticBody() { ) : IrSyntheticBody() {
override fun toString(): String = override fun toString(): String =
"IrSyntheticBodyImpl($kind)" "IrSyntheticBodyImpl($kind)"
@@ -25,7 +25,7 @@ class IrTypeOperatorCallImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val operator: IrTypeOperator, override var operator: IrTypeOperator,
override var typeOperand: IrType, override var typeOperand: IrType,
override var argument: IrExpression, override var argument: IrExpression,
) : IrTypeOperatorCall() ) : IrTypeOperatorCall()
@@ -23,7 +23,7 @@ class IrWhenImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin? = null override var origin: IrStatementOrigin? = null
) : IrWhen() { ) : IrWhen() {
constructor( constructor(
startOffset: Int, startOffset: Int,
@@ -25,7 +25,7 @@ class IrWhileLoopImpl(
override val startOffset: Int, override val startOffset: Int,
override val endOffset: Int, override val endOffset: Int,
override var type: IrType, override var type: IrType,
override val origin: IrStatementOrigin?, override var origin: IrStatementOrigin?,
) : IrWhileLoop() { ) : IrWhileLoop() {
override lateinit var condition: IrExpression override lateinit var condition: IrExpression
} }
@@ -37,10 +37,12 @@ object IrErrorClassImpl : IrClassImpl(
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
override val symbol: IrFileSymbol override val symbol: IrFileSymbol
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
override val module: IrModuleFragment override var module: IrModuleFragment
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
override val fileEntry: IrFileEntry set(_) = TODO("Not yet implemented")
override var fileEntry: IrFileEntry
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
set(_) = TODO("Not yet implemented")
override var metadata: MetadataSource? override var metadata: MetadataSource?
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
set(_) {} set(_) {}
@@ -48,8 +50,9 @@ object IrErrorClassImpl : IrClassImpl(
@ObsoleteDescriptorBasedAPI @ObsoleteDescriptorBasedAPI
override val packageFragmentDescriptor: PackageFragmentDescriptor override val packageFragmentDescriptor: PackageFragmentDescriptor
get() = TODO("Not yet implemented") get() = TODO("Not yet implemented")
override val fqName: FqName override var fqName: FqName
get() = FqName.ROOT get() = FqName.ROOT
set(_) = TODO("Not yet implemented")
} }
set(_) = TODO() set(_) = TODO()
} }
@@ -30,19 +30,19 @@ import org.jetbrains.kotlin.types.Variance
// 2) parents // 2) parents
// 3) fields // 3) fields
object IrTree : AbstractTreeBuilder() { object IrTree : AbstractTreeBuilder() {
private fun symbol(type: TypeRef) = field("symbol", type) private fun symbol(type: TypeRef) = field("symbol", type, mutable = false)
private fun descriptor(typeName: String) = private fun descriptor(typeName: String) =
field("descriptor", ClassRef<TypeParameterRef>(TypeKind.Interface, "org.jetbrains.kotlin.descriptors", typeName)) field("descriptor", ClassRef<TypeParameterRef>(TypeKind.Interface, "org.jetbrains.kotlin.descriptors", typeName), mutable = false)
private val factory: SimpleFieldConfig = field("factory", type(Packages.declarations, "IrFactory")) private val factory: SimpleFieldConfig = field("factory", type(Packages.declarations, "IrFactory"), mutable = false)
override val rootElement: ElementConfig by element(Other, name = "element") { override val rootElement: ElementConfig by element(Other, name = "element") {
accept = true accept = true
transform = true transform = true
transformByChildren = true transformByChildren = true
+field("startOffset", int) +field("startOffset", int, mutable = false)
+field("endOffset", int) +field("endOffset", int, mutable = false)
} }
val statement: ElementConfig by element(Other) val statement: ElementConfig by element(Other)
@@ -52,8 +52,8 @@ object IrTree : AbstractTreeBuilder() {
parent(mutableAnnotationContainerType) parent(mutableAnnotationContainerType)
+descriptor("DeclarationDescriptor") +descriptor("DeclarationDescriptor")
+field("origin", type(Packages.declarations, "IrDeclarationOrigin"), mutable = true) +field("origin", type(Packages.declarations, "IrDeclarationOrigin"))
+field("parent", declarationParent, mutable = true) +field("parent", declarationParent)
+factory +factory
} }
val declarationBase: ElementConfig by element(Declaration) { val declarationBase: ElementConfig by element(Declaration) {
@@ -69,12 +69,12 @@ object IrTree : AbstractTreeBuilder() {
val declarationWithVisibility: ElementConfig by element(Declaration) { val declarationWithVisibility: ElementConfig by element(Declaration) {
parent(declaration) parent(declaration)
+field("visibility", type(Packages.descriptors, "DescriptorVisibility"), mutable = true) +field("visibility", type(Packages.descriptors, "DescriptorVisibility"))
} }
val declarationWithName: ElementConfig by element(Declaration) { val declarationWithName: ElementConfig by element(Declaration) {
parent(declaration) parent(declaration)
+field("name", type<Name>(), mutable = true) +field("name", type<Name>())
} }
val possiblyExternalDeclaration: ElementConfig by element(Declaration) { val possiblyExternalDeclaration: ElementConfig by element(Declaration) {
parent(declarationWithName) parent(declarationWithName)
@@ -85,7 +85,7 @@ object IrTree : AbstractTreeBuilder() {
+symbol(symbolType) +symbol(symbolType)
} }
val metadataSourceOwner: ElementConfig by element(Declaration) { val metadataSourceOwner: ElementConfig by element(Declaration) {
+field("metadata", type(Packages.declarations, "MetadataSource"), nullable = true, mutable = true) +field("metadata", type(Packages.declarations, "MetadataSource"), nullable = true)
} }
val overridableMember: ElementConfig by element(Declaration) { val overridableMember: ElementConfig by element(Declaration) {
parent(declaration) parent(declaration)
@@ -100,14 +100,14 @@ object IrTree : AbstractTreeBuilder() {
parent(overridableMember) parent(overridableMember)
+field("symbol", s) +field("symbol", s, mutable = false)
+field("isFakeOverride", boolean) +field("isFakeOverride", boolean)
+listField("overriddenSymbols", s, mutability = Var) +listField("overriddenSymbols", s, mutability = Var)
} }
val memberWithContainerSource: ElementConfig by element(Declaration) { val memberWithContainerSource: ElementConfig by element(Declaration) {
parent(declarationWithName) parent(declarationWithName)
+field("containerSource", type<DeserializedContainerSource>(), nullable = true) +field("containerSource", type<DeserializedContainerSource>(), nullable = true, mutable = false)
} }
val valueDeclaration: ElementConfig by element(Declaration) { val valueDeclaration: ElementConfig by element(Declaration) {
parent(declarationWithName) parent(declarationWithName)
@@ -115,8 +115,8 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("ValueDescriptor") +descriptor("ValueDescriptor")
+symbol(valueSymbolType) +symbol(valueSymbolType)
+field("type", irTypeType, mutable = true) +field("type", irTypeType)
+field("isAssignable", boolean) +field("isAssignable", boolean, mutable = false)
} }
val valueParameter: ElementConfig by element(Declaration) { val valueParameter: ElementConfig by element(Declaration) {
transform = true transform = true
@@ -128,7 +128,7 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("ParameterDescriptor") +descriptor("ParameterDescriptor")
+symbol(valueParameterSymbolType) +symbol(valueParameterSymbolType)
+field("index", int) +field("index", int)
+field("varargElementType", irTypeType, nullable = true, mutable = true) +field("varargElementType", irTypeType, nullable = true)
+field("isCrossinline", boolean) +field("isCrossinline", boolean)
+field("isNoinline", boolean) +field("isNoinline", boolean)
// if true parameter is not included into IdSignature. // if true parameter is not included into IdSignature.
@@ -136,7 +136,7 @@ object IrTree : AbstractTreeBuilder() {
// NOTE: it is introduced to fix KT-40980 because more clear solution was not possible to implement. // NOTE: it is introduced to fix KT-40980 because more clear solution was not possible to implement.
// Once we are able to load any top-level declaration from klib this hack should be deprecated and removed. // Once we are able to load any top-level declaration from klib this hack should be deprecated and removed.
+field("isHidden", boolean) +field("isHidden", boolean)
+field("defaultValue", expressionBody, nullable = true, mutable = true, isChild = true) +field("defaultValue", expressionBody, nullable = true, isChild = true)
} }
val `class`: ElementConfig by element(Declaration) { val `class`: ElementConfig by element(Declaration) {
visitorParent = declarationBase visitorParent = declarationBase
@@ -152,26 +152,25 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("ClassDescriptor") +descriptor("ClassDescriptor")
+symbol(classSymbolType) +symbol(classSymbolType)
+field("kind", type<ClassKind>()) +field("kind", type<ClassKind>())
+field("modality", type<Modality>(), mutable = true) +field("modality", type<Modality>())
+field("isCompanion", boolean) +field("isCompanion", boolean)
+field("isInner", boolean) +field("isInner", boolean)
+field("isData", boolean) +field("isData", boolean)
+field("isValue", boolean) +field("isValue", boolean)
+field("isExpect", boolean) +field("isExpect", boolean)
+field("isFun", boolean) +field("isFun", boolean)
+field("source", type<SourceElement>()) +field("source", type<SourceElement>(), mutable = false)
+listField("superTypes", irTypeType, mutability = Var) +listField("superTypes", irTypeType, mutability = Var)
+field("thisReceiver", valueParameter, nullable = true, mutable = true, isChild = true) +field("thisReceiver", valueParameter, nullable = true, isChild = true)
+field( +field(
"valueClassRepresentation", "valueClassRepresentation",
type<ValueClassRepresentation<*>>().withArgs(type(Packages.types, "IrSimpleType")), type<ValueClassRepresentation<*>>().withArgs(type(Packages.types, "IrSimpleType")),
nullable = true, nullable = true,
mutable = true
) )
+listField("sealedSubclasses", classSymbolType, mutability = Var) +listField("sealedSubclasses", classSymbolType, mutability = Var)
} }
val attributeContainer: ElementConfig by element(Declaration) { val attributeContainer: ElementConfig by element(Declaration) {
+field("attributeOwnerId", attributeContainer, mutable = true) +field("attributeOwnerId", attributeContainer)
} }
val anonymousInitializer: ElementConfig by element(Declaration) { val anonymousInitializer: ElementConfig by element(Declaration) {
visitorParent = declarationBase visitorParent = declarationBase
@@ -181,7 +180,7 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("ClassDescriptor") // TODO special descriptor for anonymous initializer blocks +descriptor("ClassDescriptor") // TODO special descriptor for anonymous initializer blocks
+symbol(anonymousInitializerSymbolType) +symbol(anonymousInitializerSymbolType)
+field("isStatic", boolean) +field("isStatic", boolean)
+field("body", blockBody, mutable = true, isChild = true) +field("body", blockBody, isChild = true)
} }
val declarationContainer: ElementConfig by element(Declaration) { val declarationContainer: ElementConfig by element(Declaration) {
ownsChildren = false ownsChildren = false
@@ -236,13 +235,13 @@ object IrTree : AbstractTreeBuilder() {
// NB: there's an inline constructor for Array and each primitive array class. // NB: there's an inline constructor for Array and each primitive array class.
+field("isInline", boolean) +field("isInline", boolean)
+field("isExpect", boolean) +field("isExpect", boolean)
+field("returnType", irTypeType, mutable = true) +field("returnType", irTypeType)
+field("dispatchReceiverParameter", valueParameter, mutable = true, nullable = true, isChild = true) +field("dispatchReceiverParameter", valueParameter, nullable = true, isChild = true)
+field("extensionReceiverParameter", valueParameter, mutable = true, nullable = true, isChild = true) +field("extensionReceiverParameter", valueParameter, nullable = true, isChild = true)
+listField("valueParameters", valueParameter, mutability = Var, isChild = true) +listField("valueParameters", valueParameter, mutability = Var, isChild = true)
// The first `contextReceiverParametersCount` value parameters are context receivers. // The first `contextReceiverParametersCount` value parameters are context receivers.
+field("contextReceiverParametersCount", int, mutable = true) +field("contextReceiverParametersCount", int)
+field("body", body, mutable = true, nullable = true, isChild = true) +field("body", body, nullable = true, isChild = true)
} }
val constructor: ElementConfig by element(Declaration) { val constructor: ElementConfig by element(Declaration) {
visitorParent = function visitorParent = function
@@ -261,15 +260,15 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("ClassDescriptor") +descriptor("ClassDescriptor")
+symbol(enumEntrySymbolType) +symbol(enumEntrySymbolType)
+field("initializerExpression", expressionBody, mutable = true, nullable = true, isChild = true) +field("initializerExpression", expressionBody, nullable = true, isChild = true)
+field("correspondingClass", `class`, mutable = true, nullable = true, isChild = true) +field("correspondingClass", `class`, nullable = true, isChild = true)
} }
val errorDeclaration: ElementConfig by element(Declaration) { val errorDeclaration: ElementConfig by element(Declaration) {
visitorParent = declarationBase visitorParent = declarationBase
parent(declarationBase) parent(declarationBase)
+field("symbol", symbolType) { +field("symbol", symbolType, mutable = false) {
baseGetter = code("error(\"Should never be called\")") baseGetter = code("error(\"Should never be called\")")
} }
} }
@@ -279,8 +278,8 @@ object IrTree : AbstractTreeBuilder() {
parent(declaration) parent(declaration)
+symbol(simpleFunctionSymbolType) +symbol(simpleFunctionSymbolType)
+field("modality", type<Modality>(), mutable = true) +field("modality", type<Modality>())
+field("isBound", boolean) +field("isBound", boolean, mutable = false)
generationCallback = { generationCallback = {
addFunction( addFunction(
FunSpec.builder("acquireSymbol") FunSpec.builder("acquireSymbol")
@@ -297,10 +296,10 @@ object IrTree : AbstractTreeBuilder() {
parent(declaration) parent(declaration)
+symbol(propertySymbolType) +symbol(propertySymbolType)
+field("modality", type<Modality>(), mutable = true) +field("modality", type<Modality>())
+field("getter", simpleFunction, mutable = true, nullable = true) +field("getter", simpleFunction, nullable = true)
+field("setter", simpleFunction, mutable = true, nullable = true) +field("setter", simpleFunction, nullable = true)
+field("isBound", boolean) +field("isBound", boolean, mutable = false)
generationCallback = { generationCallback = {
addFunction( addFunction(
FunSpec.builder("acquireSymbol") FunSpec.builder("acquireSymbol")
@@ -322,11 +321,11 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("PropertyDescriptor") +descriptor("PropertyDescriptor")
+symbol(fieldSymbolType) +symbol(fieldSymbolType)
+field("type", irTypeType, mutable = true) +field("type", irTypeType)
+field("isFinal", boolean) +field("isFinal", boolean)
+field("isStatic", boolean) +field("isStatic", boolean)
+field("initializer", expressionBody, mutable = true, nullable = true, isChild = true) +field("initializer", expressionBody, nullable = true, isChild = true)
+field("correspondingPropertySymbol", propertySymbolType, mutable = true, nullable = true) +field("correspondingPropertySymbol", propertySymbolType, nullable = true)
} }
val localDelegatedProperty: ElementConfig by element(Declaration) { val localDelegatedProperty: ElementConfig by element(Declaration) {
visitorParent = declarationBase visitorParent = declarationBase
@@ -338,11 +337,11 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("VariableDescriptorWithAccessors") +descriptor("VariableDescriptorWithAccessors")
+symbol(localDelegatedPropertySymbolType) +symbol(localDelegatedPropertySymbolType)
+field("type", irTypeType, mutable = true) +field("type", irTypeType)
+field("isVar", boolean) +field("isVar", boolean)
+field("delegate", variable, mutable = true, isChild = true) +field("delegate", variable, isChild = true)
+field("getter", simpleFunction, mutable = true, isChild = true) +field("getter", simpleFunction, isChild = true)
+field("setter", simpleFunction, mutable = true, nullable = true, isChild = true) +field("setter", simpleFunction, nullable = true, isChild = true)
} }
val moduleFragment: ElementConfig by element(Declaration) { val moduleFragment: ElementConfig by element(Declaration) {
visitorParent = rootElement visitorParent = rootElement
@@ -350,14 +349,14 @@ object IrTree : AbstractTreeBuilder() {
transformByChildren = true transformByChildren = true
+descriptor("ModuleDescriptor") +descriptor("ModuleDescriptor")
+field("name", type<Name>()) +field("name", type<Name>(), mutable = false)
+field("irBuiltins", type(Packages.tree, "IrBuiltIns")) +field("irBuiltins", type(Packages.tree, "IrBuiltIns"), mutable = false)
+listField("files", file, mutability = List, isChild = true) +listField("files", file, mutability = List, isChild = true)
val undefinedOffset = MemberName(Packages.tree, "UNDEFINED_OFFSET") val undefinedOffset = MemberName(Packages.tree, "UNDEFINED_OFFSET")
+field("startOffset", int) { +field("startOffset", int, mutable = false) {
baseGetter = code("%M", undefinedOffset) baseGetter = code("%M", undefinedOffset)
} }
+field("endOffset", int) { +field("endOffset", int, mutable = false) {
baseGetter = code("%M", undefinedOffset) baseGetter = code("%M", undefinedOffset)
} }
} }
@@ -379,9 +378,9 @@ object IrTree : AbstractTreeBuilder() {
+field("isDelegated", boolean) +field("isDelegated", boolean)
+field("isExpect", boolean) +field("isExpect", boolean)
+field("isFakeOverride", boolean) +field("isFakeOverride", boolean)
+field("backingField", field, mutable = true, nullable = true, isChild = true) +field("backingField", field, nullable = true, isChild = true)
+field("getter", simpleFunction, mutable = true, nullable = true, isChild = true) +field("getter", simpleFunction, nullable = true, isChild = true)
+field("setter", simpleFunction, mutable = true, nullable = true, isChild = true) +field("setter", simpleFunction, nullable = true, isChild = true)
} }
//TODO: make IrScript as IrPackageFragment, because script is used as a file, not as a class //TODO: make IrScript as IrPackageFragment, because script is used as a file, not as a class
@@ -398,17 +397,17 @@ object IrTree : AbstractTreeBuilder() {
+symbol(scriptSymbolType) +symbol(scriptSymbolType)
// NOTE: is the result of the FE conversion, because there script interpreted as a class and has receiver // NOTE: is the result of the FE conversion, because there script interpreted as a class and has receiver
// TODO: consider removing from here and handle appropriately in the lowering // TODO: consider removing from here and handle appropriately in the lowering
+field("thisReceiver", valueParameter, mutable = true, isChild = true, nullable = true) // K1 +field("thisReceiver", valueParameter, isChild = true, nullable = true) // K1
+field("baseClass", irTypeType, mutable = true, nullable = true) // K1 +field("baseClass", irTypeType, nullable = true) // K1
+listField("explicitCallParameters", variable, mutability = Var, isChild = true) +listField("explicitCallParameters", variable, mutability = Var, isChild = true)
+listField("implicitReceiversParameters", valueParameter, mutability = Var, isChild = true) +listField("implicitReceiversParameters", valueParameter, mutability = Var, isChild = true)
+listField("providedProperties", propertySymbolType, mutability = Var) +listField("providedProperties", propertySymbolType, mutability = Var)
+listField("providedPropertiesParameters", valueParameter, mutability = Var, isChild = true) +listField("providedPropertiesParameters", valueParameter, mutability = Var, isChild = true)
+field("resultProperty", propertySymbolType, mutable = true, nullable = true) +field("resultProperty", propertySymbolType, nullable = true)
+field("earlierScriptsParameter", valueParameter, mutable = true, nullable = true, isChild = true) +field("earlierScriptsParameter", valueParameter, nullable = true, isChild = true)
+listField("earlierScripts", scriptSymbolType, mutability = Var, nullable = true) +listField("earlierScripts", scriptSymbolType, mutability = Var, nullable = true)
+field("targetClass", classSymbolType, mutable = true, nullable = true) +field("targetClass", classSymbolType, nullable = true)
+field("constructor", constructor, mutable = true, nullable = true) // K1 +field("constructor", constructor, nullable = true) // K1
} }
val simpleFunction: ElementConfig by element(Declaration) { val simpleFunction: ElementConfig by element(Declaration) {
visitorParent = function visitorParent = function
@@ -423,7 +422,7 @@ object IrTree : AbstractTreeBuilder() {
+field("isFakeOverride", boolean) +field("isFakeOverride", boolean)
+field("isOperator", boolean) +field("isOperator", boolean)
+field("isInfix", boolean) +field("isInfix", boolean)
+field("correspondingPropertySymbol", propertySymbolType, mutable = true, nullable = true) +field("correspondingPropertySymbol", propertySymbolType, nullable = true)
} }
val typeAlias: ElementConfig by element(Declaration) { val typeAlias: ElementConfig by element(Declaration) {
visitorParent = declarationBase visitorParent = declarationBase
@@ -436,7 +435,7 @@ object IrTree : AbstractTreeBuilder() {
+descriptor("TypeAliasDescriptor") +descriptor("TypeAliasDescriptor")
+symbol(typeAliasSymbolType) +symbol(typeAliasSymbolType)
+field("isActual", boolean) +field("isActual", boolean)
+field("expandedType", irTypeType, mutable = true) +field("expandedType", irTypeType)
} }
val variable: ElementConfig by element(Declaration) { val variable: ElementConfig by element(Declaration) {
visitorParent = declarationBase visitorParent = declarationBase
@@ -449,7 +448,7 @@ object IrTree : AbstractTreeBuilder() {
+field("isVar", boolean) +field("isVar", boolean)
+field("isConst", boolean) +field("isConst", boolean)
+field("isLateinit", boolean) +field("isLateinit", boolean)
+field("initializer", expression, nullable = true, mutable = true, isChild = true) +field("initializer", expression, nullable = true, isChild = true)
} }
val packageFragment: ElementConfig by element(Declaration) { val packageFragment: ElementConfig by element(Declaration) {
visitorParent = rootElement visitorParent = rootElement
@@ -459,7 +458,7 @@ object IrTree : AbstractTreeBuilder() {
parent(symbolOwner) parent(symbolOwner)
+symbol(packageFragmentSymbolType) +symbol(packageFragmentSymbolType)
+field("packageFragmentDescriptor", type(Packages.descriptors, "PackageFragmentDescriptor")) +field("packageFragmentDescriptor", type(Packages.descriptors, "PackageFragmentDescriptor"), mutable = false)
+field("fqName", type<FqName>()) +field("fqName", type<FqName>())
} }
val externalPackageFragment: ElementConfig by element(Declaration) { val externalPackageFragment: ElementConfig by element(Declaration) {
@@ -469,7 +468,7 @@ object IrTree : AbstractTreeBuilder() {
parent(packageFragment) parent(packageFragment)
+symbol(externalPackageFragmentSymbolType) +symbol(externalPackageFragmentSymbolType)
+field("containerSource", type<DeserializedContainerSource>(), nullable = true) +field("containerSource", type<DeserializedContainerSource>(), nullable = true, mutable = false)
} }
val file: ElementConfig by element(Declaration) { val file: ElementConfig by element(Declaration) {
transform = true transform = true
@@ -494,10 +493,10 @@ object IrTree : AbstractTreeBuilder() {
parent(varargElement) parent(varargElement)
parent(attributeContainer) parent(attributeContainer)
+field("attributeOwnerId", attributeContainer, mutable = true) { +field("attributeOwnerId", attributeContainer) {
baseDefaultValue = code("this") baseDefaultValue = code("this")
} }
+field("type", irTypeType, mutable = true) +field("type", irTypeType)
} }
val statementContainer: ElementConfig by element(Expression) { val statementContainer: ElementConfig by element(Expression) {
ownsChildren = false ownsChildren = false
@@ -519,7 +518,7 @@ object IrTree : AbstractTreeBuilder() {
parent(body) parent(body)
+factory +factory
+field("expression", expression, mutable = true, isChild = true) +field("expression", expression, isChild = true)
} }
val blockBody: ElementConfig by element(Expression) { val blockBody: ElementConfig by element(Expression) {
visitorParent = body visitorParent = body
@@ -547,10 +546,10 @@ object IrTree : AbstractTreeBuilder() {
parent(declarationReference) parent(declarationReference)
+field("dispatchReceiver", expression, nullable = true, mutable = true, isChild = true) { +field("dispatchReceiver", expression, nullable = true, isChild = true) {
baseDefaultValue = code("this") baseDefaultValue = code("this")
} }
+field("extensionReceiver", expression, nullable = true, mutable = true, isChild = true) { +field("extensionReceiver", expression, nullable = true, isChild = true) {
baseDefaultValue = code("this") baseDefaultValue = code("this")
} }
+symbol(s) +symbol(s)
@@ -565,7 +564,7 @@ object IrTree : AbstractTreeBuilder() {
parent(memberAccessExpression.withArgs("S" to functionSymbolType)) parent(memberAccessExpression.withArgs("S" to functionSymbolType))
+field("contextReceiversCount", int, mutable = true) +field("contextReceiversCount", int)
} }
val constructorCall: ElementConfig by element(Expression) { val constructorCall: ElementConfig by element(Expression) {
visitorParent = functionAccessExpression visitorParent = functionAccessExpression
@@ -658,8 +657,8 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("loop", loop, mutable = true) +field("loop", loop)
+field("label", string, nullable = true, mutable = true) { +field("label", string, nullable = true) {
baseDefaultValue = code("null") baseDefaultValue = code("null")
} }
} }
@@ -720,7 +719,7 @@ object IrTree : AbstractTreeBuilder() {
parent(declarationReference) parent(declarationReference)
+symbol(classifierSymbolType) +symbol(classifierSymbolType)
+field("classType", irTypeType, mutable = true) +field("classType", irTypeType)
} }
val const: ElementConfig by element(Expression) { val const: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
@@ -758,7 +757,7 @@ object IrTree : AbstractTreeBuilder() {
parent(constantValue) parent(constantValue)
+field("value", const.withArgs("T" to TypeRef.Star), mutable = true, isChild = true) +field("value", const.withArgs("T" to TypeRef.Star), isChild = true)
} }
val constantObject: ElementConfig by element(Expression) { val constantObject: ElementConfig by element(Expression) {
visitorParent = constantValue visitorParent = constantValue
@@ -794,7 +793,7 @@ object IrTree : AbstractTreeBuilder() {
parent(dynamicExpression) parent(dynamicExpression)
+field("operator", type(Packages.exprs, "IrDynamicOperator")) +field("operator", type(Packages.exprs, "IrDynamicOperator"))
+field("receiver", expression, mutable = true, isChild = true) +field("receiver", expression, isChild = true)
+listField("arguments", expression, mutability = List, isChild = true) +listField("arguments", expression, mutability = List, isChild = true)
} }
val dynamicMemberExpression: ElementConfig by element(Expression) { val dynamicMemberExpression: ElementConfig by element(Expression) {
@@ -803,7 +802,7 @@ object IrTree : AbstractTreeBuilder() {
parent(dynamicExpression) parent(dynamicExpression)
+field("memberName", string) +field("memberName", string)
+field("receiver", expression, mutable = true, isChild = true) +field("receiver", expression, isChild = true)
} }
val enumConstructorCall: ElementConfig by element(Expression) { val enumConstructorCall: ElementConfig by element(Expression) {
visitorParent = functionAccessExpression visitorParent = functionAccessExpression
@@ -825,7 +824,7 @@ object IrTree : AbstractTreeBuilder() {
parent(errorExpression) parent(errorExpression)
+field("explicitReceiver", expression, nullable = true, mutable = true, isChild = true) +field("explicitReceiver", expression, nullable = true, isChild = true)
+listField("arguments", expression, mutability = List, isChild = true) +listField("arguments", expression, mutability = List, isChild = true)
} }
val fieldAccessExpression: ElementConfig by element(Expression) { val fieldAccessExpression: ElementConfig by element(Expression) {
@@ -837,7 +836,7 @@ object IrTree : AbstractTreeBuilder() {
+symbol(fieldSymbolType) +symbol(fieldSymbolType)
+field("superQualifierSymbol", classSymbolType, nullable = true) +field("superQualifierSymbol", classSymbolType, nullable = true)
+field("receiver", expression, nullable = true, mutable = true, isChild = true) { +field("receiver", expression, nullable = true, isChild = true) {
baseDefaultValue = code("null") baseDefaultValue = code("null")
} }
+field("origin", statementOriginType, nullable = true) +field("origin", statementOriginType, nullable = true)
@@ -852,7 +851,7 @@ object IrTree : AbstractTreeBuilder() {
parent(fieldAccessExpression) parent(fieldAccessExpression)
+field("value", expression, mutable = true, isChild = true) +field("value", expression, isChild = true)
} }
val functionExpression: ElementConfig by element(Expression) { val functionExpression: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
@@ -861,14 +860,14 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("origin", statementOriginType) +field("origin", statementOriginType)
+field("function", simpleFunction, mutable = true, isChild = true) +field("function", simpleFunction, isChild = true)
} }
val getClass: ElementConfig by element(Expression) { val getClass: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
parent(expression) parent(expression)
+field("argument", expression, mutable = true, isChild = true) +field("argument", expression, isChild = true)
} }
val instanceInitializerCall: ElementConfig by element(Expression) { val instanceInitializerCall: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
@@ -885,11 +884,11 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("origin", statementOriginType, nullable = true) +field("origin", statementOriginType, nullable = true)
+field("body", expression, nullable = true, mutable = true, isChild = true) { +field("body", expression, nullable = true, isChild = true) {
baseDefaultValue = code("null") baseDefaultValue = code("null")
} }
+field("condition", expression, mutable = true, isChild = true) +field("condition", expression, isChild = true)
+field("label", string, nullable = true, mutable = true) { +field("label", string, nullable = true) {
baseDefaultValue = code("null") baseDefaultValue = code("null")
} }
} }
@@ -911,7 +910,7 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("value", expression, mutable = true, isChild = true) +field("value", expression, isChild = true)
+field("returnTargetSymbol", returnTargetSymbolType) +field("returnTargetSymbol", returnTargetSymbolType)
} }
val stringConcatenation: ElementConfig by element(Expression) { val stringConcatenation: ElementConfig by element(Expression) {
@@ -926,24 +925,24 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("suspensionPointIdParameter", variable, mutable = true, isChild = true) +field("suspensionPointIdParameter", variable, isChild = true)
+field("result", expression, mutable = true, isChild = true) +field("result", expression, isChild = true)
+field("resumeResult", expression, mutable = true, isChild = true) +field("resumeResult", expression, isChild = true)
} }
val suspendableExpression: ElementConfig by element(Expression) { val suspendableExpression: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
parent(expression) parent(expression)
+field("suspensionPointId", expression, mutable = true, isChild = true) +field("suspensionPointId", expression, isChild = true)
+field("result", expression, mutable = true, isChild = true) +field("result", expression, isChild = true)
} }
val `throw`: ElementConfig by element(Expression) { val `throw`: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
parent(expression) parent(expression)
+field("value", expression, mutable = true, isChild = true) +field("value", expression, isChild = true)
} }
val `try`: ElementConfig by element(Expression) { val `try`: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
@@ -951,9 +950,9 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("tryResult", expression, mutable = true, isChild = true) +field("tryResult", expression, isChild = true)
+listField("catches", catch, mutability = List, isChild = true) +listField("catches", catch, mutability = List, isChild = true)
+field("finallyExpression", expression, nullable = true, mutable = true, isChild = true) +field("finallyExpression", expression, nullable = true, isChild = true)
} }
val catch: ElementConfig by element(Expression) { val catch: ElementConfig by element(Expression) {
visitorParent = rootElement visitorParent = rootElement
@@ -961,8 +960,8 @@ object IrTree : AbstractTreeBuilder() {
transform = true transform = true
transformByChildren = true transformByChildren = true
+field("catchParameter", variable, mutable = true, isChild = true) +field("catchParameter", variable, isChild = true)
+field("result", expression, mutable = true, isChild = true) +field("result", expression, isChild = true)
} }
val typeOperatorCall: ElementConfig by element(Expression) { val typeOperatorCall: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
@@ -971,8 +970,8 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("operator", type(Packages.exprs, "IrTypeOperator")) +field("operator", type(Packages.exprs, "IrTypeOperator"))
+field("argument", expression, mutable = true, isChild = true) +field("argument", expression, isChild = true)
+field("typeOperand", irTypeType, mutable = true) +field("typeOperand", irTypeType)
} }
val valueAccessExpression: ElementConfig by element(Expression) { val valueAccessExpression: ElementConfig by element(Expression) {
visitorParent = declarationReference visitorParent = declarationReference
@@ -994,7 +993,7 @@ object IrTree : AbstractTreeBuilder() {
parent(valueAccessExpression) parent(valueAccessExpression)
+symbol(valueSymbolType) +symbol(valueSymbolType)
+field("value", expression, mutable = true, isChild = true) +field("value", expression, isChild = true)
} }
val varargElement: ElementConfig by element(Expression) val varargElement: ElementConfig by element(Expression)
val vararg: ElementConfig by element(Expression) { val vararg: ElementConfig by element(Expression) {
@@ -1002,7 +1001,7 @@ object IrTree : AbstractTreeBuilder() {
parent(expression) parent(expression)
+field("varargElementType", irTypeType, mutable = true) +field("varargElementType", irTypeType)
+listField("elements", varargElement, mutability = List, isChild = true) +listField("elements", varargElement, mutability = List, isChild = true)
} }
val spreadElement: ElementConfig by element(Expression) { val spreadElement: ElementConfig by element(Expression) {
@@ -1013,7 +1012,7 @@ object IrTree : AbstractTreeBuilder() {
parent(varargElement) parent(varargElement)
+field("expression", expression, mutable = true, isChild = true) +field("expression", expression, isChild = true)
} }
val `when`: ElementConfig by element(Expression) { val `when`: ElementConfig by element(Expression) {
visitorParent = expression visitorParent = expression
@@ -1030,8 +1029,8 @@ object IrTree : AbstractTreeBuilder() {
transform = true transform = true
transformByChildren = true transformByChildren = true
+field("condition", expression, mutable = true, isChild = true) +field("condition", expression, isChild = true)
+field("result", expression, mutable = true, isChild = true) +field("result", expression, isChild = true)
} }
val elseBranch: ElementConfig by element(Expression) { val elseBranch: ElementConfig by element(Expression) {
visitorParent = branch visitorParent = branch
@@ -38,7 +38,7 @@ abstract class AbstractTreeBuilder {
name: String, name: String,
type: TypeRef?, type: TypeRef?,
nullable: Boolean = false, nullable: Boolean = false,
mutable: Boolean = false, mutable: Boolean = true,
isChild: Boolean = false, isChild: Boolean = false,
initializer: SimpleFieldConfig.() -> Unit = {} initializer: SimpleFieldConfig.() -> Unit = {}
): SimpleFieldConfig { ): SimpleFieldConfig {