Hide stageController into the IrFactory
This commit is contained in:
+5
-5
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.AnonymousInitializerCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
|
||||
@@ -24,7 +23,8 @@ internal class PersistentIrAnonymousInitializer(
|
||||
override val endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrAnonymousInitializerSymbol,
|
||||
override val isStatic: Boolean = false
|
||||
override val isStatic: Boolean = false,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrAnonymousInitializer(),
|
||||
PersistentIrDeclarationBase<AnonymousInitializerCarrier>,
|
||||
AnonymousInitializerCarrier {
|
||||
@@ -33,10 +33,10 @@ internal class PersistentIrAnonymousInitializer(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+7
-7
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.ClassCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
@@ -47,7 +46,8 @@ internal class PersistentIrClass(
|
||||
override val isInline: Boolean = false,
|
||||
override val isExpect: Boolean = false,
|
||||
override val isFun: Boolean = false,
|
||||
override val source: SourceElement = SourceElement.NO_SOURCE
|
||||
override val source: SourceElement = SourceElement.NO_SOURCE,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrClass(),
|
||||
PersistentIrDeclarationBase<ClassCarrier>,
|
||||
ClassCarrier {
|
||||
@@ -56,10 +56,10 @@ internal class PersistentIrClass(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
@@ -94,11 +94,11 @@ internal class PersistentIrClass(
|
||||
|
||||
override val declarations: MutableList<IrDeclaration> = ArrayList()
|
||||
get() {
|
||||
if (createdOn < stageController.currentStage && initialDeclarations == null) {
|
||||
if (createdOn < factory.stageController.currentStage && initialDeclarations == null) {
|
||||
initialDeclarations = Collections.unmodifiableList(ArrayList(field))
|
||||
}
|
||||
|
||||
return if (stageController.canAccessDeclarationsOf(this)) {
|
||||
return if (factory.stageController.canAccessDeclarationsOf(this)) {
|
||||
ensureLowered()
|
||||
field
|
||||
} else {
|
||||
|
||||
+5
-5
@@ -16,7 +16,6 @@ import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.ConstructorCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
@@ -40,7 +39,8 @@ internal class PersistentIrConstructor(
|
||||
isExternal: Boolean,
|
||||
override val isPrimary: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrConstructor(),
|
||||
PersistentIrDeclarationBase<ConstructorCarrier>,
|
||||
ConstructorCarrier {
|
||||
@@ -49,10 +49,10 @@ internal class PersistentIrConstructor(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.EnumEntryCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
||||
@@ -26,7 +25,8 @@ internal class PersistentIrEnumEntry(
|
||||
override val endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrEnumEntrySymbol,
|
||||
override val name: Name
|
||||
override val name: Name,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrEnumEntry(),
|
||||
PersistentIrDeclarationBase<EnumEntryCarrier>,
|
||||
EnumEntryCarrier {
|
||||
@@ -35,10 +35,10 @@ internal class PersistentIrEnumEntry(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.IrErrorDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.ErrorDeclarationCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
|
||||
@@ -22,17 +21,18 @@ import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
internal class PersistentIrErrorDeclaration(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
private val _descriptor: DeclarationDescriptor?
|
||||
private val _descriptor: DeclarationDescriptor?,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrErrorDeclaration(),
|
||||
PersistentIrDeclarationBase<ErrorDeclarationCarrier>,
|
||||
ErrorDeclarationCarrier {
|
||||
override val descriptor: DeclarationDescriptor
|
||||
get() = _descriptor ?: this.toIrBasedDescriptor()
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = IrDeclarationOrigin.DEFINED
|
||||
|
||||
+5
-5
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.ir.declarations.IrField
|
||||
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.FieldCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
@@ -34,7 +33,8 @@ internal class PersistentIrField(
|
||||
override var visibility: DescriptorVisibility,
|
||||
override val isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
override val isStatic: Boolean
|
||||
override val isStatic: Boolean,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrField(),
|
||||
PersistentIrDeclarationBase<FieldCarrier>,
|
||||
FieldCarrier {
|
||||
@@ -43,10 +43,10 @@ internal class PersistentIrField(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.FunctionCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
@@ -42,15 +41,16 @@ internal abstract class PersistentIrFunctionCommon(
|
||||
override val isOperator: Boolean,
|
||||
override val isInfix: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
override val containerSource: DeserializedContainerSource? = null
|
||||
override val containerSource: DeserializedContainerSource? = null,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrSimpleFunction(),
|
||||
PersistentIrDeclarationBase<FunctionCarrier>,
|
||||
FunctionCarrier {
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.LocalDelegatedPropertyCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
@@ -31,7 +30,8 @@ internal class PersistentIrLocalDelegatedProperty(
|
||||
override val symbol: IrLocalDelegatedPropertySymbol,
|
||||
override val name: Name,
|
||||
type: IrType,
|
||||
override val isVar: Boolean
|
||||
override val isVar: Boolean,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrLocalDelegatedProperty(),
|
||||
PersistentIrDeclarationBase<LocalDelegatedPropertyCarrier>,
|
||||
LocalDelegatedPropertyCarrier {
|
||||
@@ -40,10 +40,10 @@ internal class PersistentIrLocalDelegatedProperty(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.PropertyCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
@@ -34,15 +33,16 @@ internal abstract class PersistentIrPropertyCommon(
|
||||
override val isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
override val containerSource: DeserializedContainerSource?
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrProperty(),
|
||||
PersistentIrDeclarationBase<PropertyCarrier>,
|
||||
PropertyCarrier {
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -14,7 +14,6 @@ import org.jetbrains.kotlin.ir.declarations.IrTypeAlias
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.TypeAliasCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
@@ -30,7 +29,8 @@ internal class PersistentIrTypeAlias(
|
||||
override var visibility: DescriptorVisibility,
|
||||
expandedType: IrType,
|
||||
override val isActual: Boolean,
|
||||
origin: IrDeclarationOrigin
|
||||
origin: IrDeclarationOrigin,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrTypeAlias(),
|
||||
PersistentIrDeclarationBase<TypeAliasCarrier>,
|
||||
TypeAliasCarrier {
|
||||
@@ -39,10 +39,10 @@ internal class PersistentIrTypeAlias(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.TypeParameterCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
@@ -29,7 +28,8 @@ internal class PersistentIrTypeParameter(
|
||||
override val name: Name,
|
||||
override val index: Int,
|
||||
override val isReified: Boolean,
|
||||
override val variance: Variance
|
||||
override val variance: Variance,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrTypeParameter(),
|
||||
PersistentIrDeclarationBase<TypeParameterCarrier>,
|
||||
TypeParameterCarrier {
|
||||
@@ -38,10 +38,10 @@ internal class PersistentIrTypeParameter(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+5
-5
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.ValueParameterCarrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
||||
@@ -33,7 +32,8 @@ internal class PersistentIrValueParameter(
|
||||
override val isCrossinline: Boolean,
|
||||
override val isNoinline: Boolean,
|
||||
override val isHidden: Boolean,
|
||||
override val isAssignable: Boolean
|
||||
override val isAssignable: Boolean,
|
||||
override val factory: PersistentIrFactory
|
||||
) : IrValueParameter(),
|
||||
PersistentIrDeclarationBase<ValueParameterCarrier>,
|
||||
ValueParameterCarrier {
|
||||
@@ -46,10 +46,10 @@ internal class PersistentIrValueParameter(
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var parentField: IrDeclarationParent? = null
|
||||
override var originField: IrDeclarationOrigin = origin
|
||||
|
||||
+1
@@ -18,6 +18,7 @@ internal fun PersistentIrGenerator.generateAnonymousInitializer() {
|
||||
origin,
|
||||
+"override val symbol: " + IrAnonymousInitializerSymbol,
|
||||
isStatic + " = false",
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("AnonymousInitializer") + " " + blockSpaced(
|
||||
initBlock,
|
||||
|
||||
+3
-2
@@ -36,6 +36,7 @@ internal fun PersistentIrGenerator.generateClass() {
|
||||
isExpect + " = false",
|
||||
isFun,
|
||||
source,
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("Class") + " " + blockSpaced(
|
||||
initBlock,
|
||||
@@ -49,12 +50,12 @@ internal fun PersistentIrGenerator.generateClass() {
|
||||
+"override val declarations: MutableList<IrDeclaration> = " + import("ArrayList", "java.util") + "()",
|
||||
lines(
|
||||
+"get() " + block(
|
||||
+"if (createdOn < stageController.currentStage && initialDeclarations == null) " + block(
|
||||
+"if (createdOn < factory.stageController.currentStage && initialDeclarations == null) " + block(
|
||||
+"initialDeclarations = " + import("Collections", "java.util") + ".unmodifiableList(ArrayList(field))"
|
||||
),
|
||||
id,
|
||||
+"""
|
||||
return if (stageController.canAccessDeclarationsOf(this)) {
|
||||
return if (factory.stageController.canAccessDeclarationsOf(this)) {
|
||||
ensureLowered()
|
||||
field
|
||||
} else {
|
||||
|
||||
+1
@@ -33,6 +33,7 @@ internal fun PersistentIrGenerator.generateConstructor() {
|
||||
isPrimary,
|
||||
isExpect,
|
||||
containerSource,
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("Constructor") + " " + blockSpaced(
|
||||
initBlock,
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ internal fun PersistentIrGenerator.generateEnumEntry() {
|
||||
origin,
|
||||
+"override val symbol: " + irSymbol("IrEnumEntrySymbol"),
|
||||
name,
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("EnumEntry") + " " + blockSpaced(
|
||||
initBlock,
|
||||
|
||||
+2
-1
@@ -15,7 +15,8 @@ internal fun PersistentIrGenerator.generateErrorDeclaration() {
|
||||
arrayOf(
|
||||
startOffset,
|
||||
endOffset,
|
||||
+"private val _descriptor: " + DeclarationDescriptor + "?"
|
||||
+"private val _descriptor: " + DeclarationDescriptor + "?",
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("ErrorDeclaration") + " " + block(
|
||||
lines(
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ internal fun PersistentIrGenerator.generateField() {
|
||||
isFinal,
|
||||
isExternal,
|
||||
isStatic,
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("Field") + " " + blockSpaced(
|
||||
initBlock,
|
||||
|
||||
+1
@@ -39,6 +39,7 @@ internal fun PersistentIrGenerator.generateFunction() {
|
||||
+"override val isInfix: Boolean",
|
||||
isExpect,
|
||||
containerSource + " = null",
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("Function", baseClass = "IrSimpleFunction") + " " + blockSpaced(
|
||||
commonFields,
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ internal fun PersistentIrGenerator.generateLocalDelegatedProperty() {
|
||||
name,
|
||||
+"type: " + IrType,
|
||||
+"override val isVar: Boolean",
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("LocalDelegatedProperty") + " " + blockSpaced(
|
||||
initBlock,
|
||||
|
||||
+5
-5
@@ -53,8 +53,6 @@ internal object PersistentIrGenerator {
|
||||
|
||||
val ObsoleteDescriptorBasedAPI = import("ObsoleteDescriptorBasedAPI", "org.jetbrains.kotlin.ir")
|
||||
|
||||
val stageController = import("stageController", "org.jetbrains.kotlin.ir.declarations")
|
||||
|
||||
val IrType = import("IrType", "org.jetbrains.kotlin.ir.types")
|
||||
|
||||
val IrPropertySymbol = irSymbol("IrPropertySymbol")
|
||||
@@ -82,15 +80,17 @@ internal object PersistentIrGenerator {
|
||||
val isPrimary = +"override val isPrimary: Boolean"
|
||||
val containerSource = +"override val containerSource: " + import("DeserializedContainerSource", "org.jetbrains.kotlin.serialization.deserialization.descriptors") + "?"
|
||||
|
||||
val irFactory = +"override val factory: PersistentIrFactory"
|
||||
|
||||
val initBlock = +"init " + block(
|
||||
+"symbol.bind(this)"
|
||||
)
|
||||
|
||||
// Fields
|
||||
val lastModified = +"override var lastModified: Int = " + stageController + ".currentStage"
|
||||
val loweredUpTo = +"override var loweredUpTo: Int = " + stageController + ".currentStage"
|
||||
val lastModified = +"override var lastModified: Int = factory.stageController.currentStage"
|
||||
val loweredUpTo = +"override var loweredUpTo: Int = factory.stageController.currentStage"
|
||||
val values = +"override var values: Array<" + Carrier + ">? = null"
|
||||
val createdOn = +"override val createdOn: Int = " + stageController + ".currentStage"
|
||||
val createdOn = +"override val createdOn: Int = factory.stageController.currentStage"
|
||||
|
||||
val parentField = +"override var parentField: " + IrDeclarationParent + "? = null"
|
||||
val originField = +"override var originField: " + IrDeclarationOrigin + " = origin"
|
||||
|
||||
+2
-1
@@ -29,7 +29,8 @@ internal fun PersistentIrGenerator.generateProperty() {
|
||||
+"override val isDelegated: Boolean",
|
||||
isExternal,
|
||||
isExpect,
|
||||
containerSource
|
||||
containerSource,
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("Property") + " " + blockSpaced(
|
||||
commonFields,
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ internal fun PersistentIrGenerator.generateTypeAlias() {
|
||||
+"expandedType: " + IrType,
|
||||
+"override val isActual: Boolean",
|
||||
origin,
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("TypeAlias") + " " + blockSpaced(
|
||||
initBlock,
|
||||
|
||||
+2
-1
@@ -20,7 +20,8 @@ internal fun PersistentIrGenerator.generateTypeParameter() {
|
||||
name,
|
||||
+"override val index: Int",
|
||||
+"override val isReified: Boolean",
|
||||
+"override val variance: " + import("Variance", "org.jetbrains.kotlin.types")
|
||||
+"override val variance: " + import("Variance", "org.jetbrains.kotlin.types"),
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("TypeParameter") + " " + blockSpaced(
|
||||
initBlock,
|
||||
|
||||
+2
-1
@@ -27,7 +27,8 @@ internal fun PersistentIrGenerator.generateValueParameter() {
|
||||
+"override val isCrossinline: Boolean",
|
||||
+"override val isNoinline: Boolean",
|
||||
+"override val isHidden: Boolean",
|
||||
+"override val isAssignable: Boolean"
|
||||
+"override val isAssignable: Boolean",
|
||||
irFactory,
|
||||
).join(separator = ",\n").indent(),
|
||||
+") : " + baseClasses("ValueParameter") + " " + blockSpaced(
|
||||
descriptor(descriptorType("ParameterDescriptor")),
|
||||
|
||||
+13
-13
@@ -17,9 +17,6 @@ import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
interface PersistentIrDeclarationBase<T : DeclarationCarrier> : PersistentIrElementBase<T>, IrDeclaration, DeclarationCarrier {
|
||||
var removedOn: Int
|
||||
|
||||
override val factory: IrFactory
|
||||
get() = PersistentIrFactory
|
||||
|
||||
// TODO reduce boilerplate
|
||||
override var parent: IrDeclarationParent
|
||||
get() = getCarrier().parentField ?: throw UninitializedPropertyAccessException("Parent not initialized: $this")
|
||||
@@ -46,13 +43,16 @@ interface PersistentIrDeclarationBase<T : DeclarationCarrier> : PersistentIrElem
|
||||
}
|
||||
|
||||
override fun ensureLowered() {
|
||||
if (stageController.currentStage > loweredUpTo) {
|
||||
stageController.lazyLower(this)
|
||||
if (factory.stageController.currentStage > loweredUpTo) {
|
||||
factory.stageController.lazyLower(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface PersistentIrElementBase<T : Carrier> : IrElement, Carrier {
|
||||
|
||||
val factory: PersistentIrFactory
|
||||
|
||||
override var lastModified: Int
|
||||
|
||||
var loweredUpTo: Int
|
||||
@@ -66,7 +66,7 @@ interface PersistentIrElementBase<T : Carrier> : IrElement, Carrier {
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun getCarrier(): T {
|
||||
stageController.currentStage.let { stage ->
|
||||
factory.stageController.currentStage.let { stage ->
|
||||
ensureLowered()
|
||||
|
||||
if (stage >= lastModified) return this as T
|
||||
@@ -97,11 +97,11 @@ interface PersistentIrElementBase<T : Carrier> : IrElement, Carrier {
|
||||
// TODO naming? e.g. `mutableCarrier`
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun setCarrier(): T {
|
||||
val stage = stageController.currentStage
|
||||
val stage = factory.stageController.currentStage
|
||||
|
||||
ensureLowered()
|
||||
|
||||
if (!stageController.canModify(this)) {
|
||||
if (!factory.stageController.canModify(this)) {
|
||||
error("Cannot modify this element!")
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ interface PersistentIrBodyBase<B : PersistentIrBodyBase<B>> : PersistentIrElemen
|
||||
}
|
||||
|
||||
fun <T> checkEnabled(fn: () -> T): T {
|
||||
if (!stageController.bodiesEnabled) error("Bodies disabled!")
|
||||
if (!factory.stageController.bodiesEnabled) error("Bodies disabled!")
|
||||
ensureLowered()
|
||||
return fn()
|
||||
}
|
||||
@@ -145,14 +145,14 @@ interface PersistentIrBodyBase<B : PersistentIrBodyBase<B>> : PersistentIrElemen
|
||||
override fun ensureLowered() {
|
||||
initializer?.let { initFn ->
|
||||
initializer = null
|
||||
stageController.withStage(createdOn) {
|
||||
stageController.bodyLowering {
|
||||
factory.stageController.withStage(createdOn) {
|
||||
factory.stageController.bodyLowering {
|
||||
initFn.invoke(this as B)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (loweredUpTo + 1 < stageController.currentStage) {
|
||||
stageController.lazyLower(this as IrBody)
|
||||
if (loweredUpTo + 1 < factory.stageController.currentStage) {
|
||||
factory.stageController.lazyLower(this as IrBody)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-19
@@ -19,7 +19,10 @@ import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
object PersistentIrFactory : IrFactory {
|
||||
class PersistentIrFactory : IrFactory {
|
||||
|
||||
override var stageController = StageController()
|
||||
|
||||
override fun createAnonymousInitializer(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
@@ -27,7 +30,7 @@ object PersistentIrFactory : IrFactory {
|
||||
symbol: IrAnonymousInitializerSymbol,
|
||||
isStatic: Boolean,
|
||||
): IrAnonymousInitializer =
|
||||
PersistentIrAnonymousInitializer(startOffset, endOffset, origin, symbol, isStatic)
|
||||
PersistentIrAnonymousInitializer(startOffset, endOffset, origin, symbol, isStatic, this)
|
||||
|
||||
override fun createClass(
|
||||
startOffset: Int,
|
||||
@@ -50,6 +53,7 @@ object PersistentIrFactory : IrFactory {
|
||||
PersistentIrClass(
|
||||
startOffset, endOffset, origin, symbol, name, kind, visibility, modality,
|
||||
isCompanion, isInner, isData, isExternal, isInline, isExpect, isFun, source,
|
||||
this
|
||||
)
|
||||
|
||||
override fun createConstructor(
|
||||
@@ -68,7 +72,7 @@ object PersistentIrFactory : IrFactory {
|
||||
): IrConstructor =
|
||||
PersistentIrConstructor(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, returnType, isInline, isExternal, isPrimary, isExpect,
|
||||
containerSource,
|
||||
containerSource, this
|
||||
)
|
||||
|
||||
override fun createEnumEntry(
|
||||
@@ -78,14 +82,14 @@ object PersistentIrFactory : IrFactory {
|
||||
symbol: IrEnumEntrySymbol,
|
||||
name: Name,
|
||||
): IrEnumEntry =
|
||||
PersistentIrEnumEntry(startOffset, endOffset, origin, symbol, name)
|
||||
PersistentIrEnumEntry(startOffset, endOffset, origin, symbol, name, this)
|
||||
|
||||
override fun createErrorDeclaration(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: DeclarationDescriptor?,
|
||||
): IrErrorDeclaration =
|
||||
PersistentIrErrorDeclaration(startOffset, endOffset, descriptor)
|
||||
PersistentIrErrorDeclaration(startOffset, endOffset, descriptor, this)
|
||||
|
||||
override fun createField(
|
||||
startOffset: Int,
|
||||
@@ -99,7 +103,7 @@ object PersistentIrFactory : IrFactory {
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean,
|
||||
): IrField =
|
||||
PersistentIrField(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic)
|
||||
PersistentIrField(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic, this)
|
||||
|
||||
override fun createFunction(
|
||||
startOffset: Int,
|
||||
@@ -123,7 +127,7 @@ object PersistentIrFactory : IrFactory {
|
||||
PersistentIrFunction(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality, returnType,
|
||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect, isFakeOverride,
|
||||
containerSource
|
||||
containerSource, this
|
||||
)
|
||||
|
||||
override fun createFakeOverrideFunction(
|
||||
@@ -144,7 +148,7 @@ object PersistentIrFactory : IrFactory {
|
||||
): IrSimpleFunction =
|
||||
PersistentIrFakeOverrideFunction(
|
||||
startOffset, endOffset, origin, name, visibility, modality, returnType,
|
||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect, this
|
||||
)
|
||||
|
||||
override fun createLocalDelegatedProperty(
|
||||
@@ -157,7 +161,7 @@ object PersistentIrFactory : IrFactory {
|
||||
isVar: Boolean,
|
||||
): IrLocalDelegatedProperty =
|
||||
PersistentIrLocalDelegatedProperty(
|
||||
startOffset, endOffset, origin, symbol, name, type, isVar
|
||||
startOffset, endOffset, origin, symbol, name, type, isVar, this
|
||||
)
|
||||
|
||||
override fun createProperty(
|
||||
@@ -180,7 +184,7 @@ object PersistentIrFactory : IrFactory {
|
||||
PersistentIrProperty(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, isFakeOverride,
|
||||
containerSource
|
||||
containerSource, this
|
||||
)
|
||||
|
||||
override fun createFakeOverrideProperty(
|
||||
@@ -200,6 +204,7 @@ object PersistentIrFactory : IrFactory {
|
||||
PersistentIrFakeOverrideProperty(
|
||||
startOffset, endOffset, origin, name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
this
|
||||
)
|
||||
|
||||
override fun createTypeAlias(
|
||||
@@ -212,7 +217,7 @@ object PersistentIrFactory : IrFactory {
|
||||
isActual: Boolean,
|
||||
origin: IrDeclarationOrigin,
|
||||
): IrTypeAlias =
|
||||
PersistentIrTypeAlias(startOffset, endOffset, symbol, name, visibility, expandedType, isActual, origin)
|
||||
PersistentIrTypeAlias(startOffset, endOffset, symbol, name, visibility, expandedType, isActual, origin, this)
|
||||
|
||||
override fun createTypeParameter(
|
||||
startOffset: Int,
|
||||
@@ -224,7 +229,7 @@ object PersistentIrFactory : IrFactory {
|
||||
isReified: Boolean,
|
||||
variance: Variance,
|
||||
): IrTypeParameter =
|
||||
PersistentIrTypeParameter(startOffset, endOffset, origin, symbol, name, index, isReified, variance)
|
||||
PersistentIrTypeParameter(startOffset, endOffset, origin, symbol, name, index, isReified, variance, this)
|
||||
|
||||
override fun createValueParameter(
|
||||
startOffset: Int,
|
||||
@@ -241,7 +246,7 @@ object PersistentIrFactory : IrFactory {
|
||||
isAssignable: Boolean
|
||||
): IrValueParameter =
|
||||
PersistentIrValueParameter(
|
||||
startOffset, endOffset, origin, symbol, name, index, type, varargElementType, isCrossinline, isNoinline, isHidden, isAssignable
|
||||
startOffset, endOffset, origin, symbol, name, index, type, varargElementType, isCrossinline, isNoinline, isHidden, isAssignable, this
|
||||
)
|
||||
|
||||
override fun createExpressionBody(
|
||||
@@ -249,37 +254,37 @@ object PersistentIrFactory : IrFactory {
|
||||
endOffset: Int,
|
||||
initializer: IrExpressionBody.() -> Unit,
|
||||
): IrExpressionBody =
|
||||
PersistentIrExpressionBody(startOffset, endOffset, initializer)
|
||||
PersistentIrExpressionBody(startOffset, endOffset, this, initializer)
|
||||
|
||||
override fun createExpressionBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
expression: IrExpression,
|
||||
): IrExpressionBody =
|
||||
PersistentIrExpressionBody(startOffset, endOffset, expression)
|
||||
PersistentIrExpressionBody(startOffset, endOffset, expression, this)
|
||||
|
||||
override fun createExpressionBody(
|
||||
expression: IrExpression,
|
||||
): IrExpressionBody =
|
||||
PersistentIrExpressionBody(expression)
|
||||
PersistentIrExpressionBody(expression, this)
|
||||
|
||||
override fun createBlockBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
): IrBlockBody =
|
||||
PersistentIrBlockBody(startOffset, endOffset)
|
||||
PersistentIrBlockBody(startOffset, endOffset, this)
|
||||
|
||||
override fun createBlockBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
statements: List<IrStatement>,
|
||||
): IrBlockBody =
|
||||
PersistentIrBlockBody(startOffset, endOffset, statements)
|
||||
PersistentIrBlockBody(startOffset, endOffset, statements, this)
|
||||
|
||||
override fun createBlockBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
initializer: IrBlockBody.() -> Unit,
|
||||
): IrBlockBody =
|
||||
PersistentIrBlockBody(startOffset, endOffset, initializer)
|
||||
PersistentIrBlockBody(startOffset, endOffset, this, initializer)
|
||||
}
|
||||
|
||||
+5
-3
@@ -33,11 +33,12 @@ internal class PersistentIrFunction(
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
containerSource: DeserializedContainerSource?
|
||||
containerSource: DeserializedContainerSource?,
|
||||
factory: PersistentIrFactory,
|
||||
) : PersistentIrFunctionCommon(
|
||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
containerSource
|
||||
containerSource, factory
|
||||
) {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: FunctionDescriptor
|
||||
@@ -63,9 +64,10 @@ internal class PersistentIrFakeOverrideFunction(
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
factory: PersistentIrFactory,
|
||||
) : PersistentIrFunctionCommon(
|
||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect, factory = factory
|
||||
), IrFakeOverrideFunction {
|
||||
override val isFakeOverride: Boolean
|
||||
get() = true
|
||||
|
||||
+4
-2
@@ -35,9 +35,10 @@ internal class PersistentIrProperty(
|
||||
isExpect: Boolean = false,
|
||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
factory: PersistentIrFactory,
|
||||
) : PersistentIrPropertyCommon(
|
||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
containerSource,
|
||||
containerSource, factory
|
||||
) {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
@@ -61,10 +62,11 @@ internal class PersistentIrFakeOverrideProperty(
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
factory: PersistentIrFactory,
|
||||
) : PersistentIrPropertyCommon(
|
||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit,
|
||||
isDelegated, isExternal, isExpect,
|
||||
containerSource = null,
|
||||
containerSource = null, factory
|
||||
), IrFakeOverrideProperty {
|
||||
override val isFakeOverride: Boolean
|
||||
get() = true
|
||||
|
||||
+5
-9
@@ -18,26 +18,25 @@ package org.jetbrains.kotlin.ir.expressions.persistent
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrBodyBase
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||
|
||||
internal class PersistentIrBlockBody(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override val factory: PersistentIrFactory,
|
||||
override var initializer: (PersistentIrBlockBody.() -> Unit)? = null
|
||||
) : IrBlockBody(), PersistentIrBodyBase<PersistentIrBlockBody> {
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var containerField: IrDeclaration? = null
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, statements: List<IrStatement>) : this(startOffset, endOffset) {
|
||||
constructor(startOffset: Int, endOffset: Int, statements: List<IrStatement>, factory: PersistentIrFactory) : this(startOffset, endOffset, factory) {
|
||||
statementsField.addAll(statements)
|
||||
}
|
||||
|
||||
@@ -45,7 +44,4 @@ internal class PersistentIrBlockBody(
|
||||
|
||||
override val statements: MutableList<IrStatement>
|
||||
get() = checkEnabled { statementsField }
|
||||
|
||||
override val factory: IrFactory
|
||||
get() = PersistentIrFactory
|
||||
}
|
||||
|
||||
+9
-13
@@ -17,40 +17,36 @@
|
||||
package org.jetbrains.kotlin.ir.expressions.persistent
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrBodyBase
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.PersistentIrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.persistent.carriers.Carrier
|
||||
import org.jetbrains.kotlin.ir.declarations.stageController
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
|
||||
internal class PersistentIrExpressionBody private constructor(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override val factory: PersistentIrFactory,
|
||||
private var expressionField: IrExpression? = null,
|
||||
override var initializer: (PersistentIrExpressionBody.() -> Unit)? = null
|
||||
override var initializer: (PersistentIrExpressionBody.() -> Unit)? = null,
|
||||
) : IrExpressionBody(), PersistentIrBodyBase<PersistentIrExpressionBody> {
|
||||
override var lastModified: Int = stageController.currentStage
|
||||
override var loweredUpTo: Int = stageController.currentStage
|
||||
override var lastModified: Int = factory.stageController.currentStage
|
||||
override var loweredUpTo: Int = factory.stageController.currentStage
|
||||
override var values: Array<Carrier>? = null
|
||||
override val createdOn: Int = stageController.currentStage
|
||||
override val createdOn: Int = factory.stageController.currentStage
|
||||
|
||||
override var containerField: IrDeclaration? = null
|
||||
|
||||
constructor(expression: IrExpression) : this(expression.startOffset, expression.endOffset, expression, null)
|
||||
constructor(expression: IrExpression, factory: PersistentIrFactory) : this(expression.startOffset, expression.endOffset, factory, expression, null)
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, expression: IrExpression) : this(startOffset, endOffset, expression, null)
|
||||
constructor(startOffset: Int, endOffset: Int, expression: IrExpression,factory: PersistentIrFactory) : this(startOffset, endOffset, factory, expression, null)
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, initializer: IrExpressionBody.() -> Unit) :
|
||||
this(startOffset, endOffset, null, initializer)
|
||||
constructor(startOffset: Int, endOffset: Int, factory: PersistentIrFactory, initializer: IrExpressionBody.() -> Unit) :
|
||||
this(startOffset, endOffset, factory, null, initializer)
|
||||
|
||||
override var expression: IrExpression
|
||||
get() = checkEnabled { expressionField!! }
|
||||
set(e) {
|
||||
checkEnabled { expressionField = e }
|
||||
}
|
||||
|
||||
override val factory: IrFactory
|
||||
get() = PersistentIrFactory
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user