[IR] Remove some default values from implementation classes' constructors
To make it a bit easier and cleaner to autogenerate them. Those default values were mostly unused anyway. ^KT-65773 In Progress
This commit is contained in:
committed by
Space Team
parent
2a5b4ae652
commit
f6b2a5915e
+2
-1
@@ -39,6 +39,7 @@ import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.builders.declarations.UNDEFINED_PARAMETER_INDEX
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.*
|
||||
@@ -297,7 +298,7 @@ class Fir2IrDeclarationStorage(
|
||||
) : IrClassImpl(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, origin, IrClassSymbolImpl(), name,
|
||||
ClassKind.CLASS, DescriptorVisibilities.PUBLIC, Modality.FINAL,
|
||||
source = source
|
||||
source, IrFactoryImpl,
|
||||
)
|
||||
|
||||
private class NonCachedSourceFacadeContainerSource(
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.util.DeserializableClass
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -24,7 +25,7 @@ class JvmFileFacadeClass(
|
||||
) : IrClassImpl(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, origin,
|
||||
IrClassSymbolImpl(), name, ClassKind.CLASS, DescriptorVisibilities.PUBLIC, Modality.FINAL,
|
||||
source = source
|
||||
source, IrFactoryImpl
|
||||
), DeserializableClass {
|
||||
|
||||
private var irLoaded: Boolean? = null
|
||||
|
||||
+2
-2
@@ -21,8 +21,8 @@ class IrAnonymousInitializerImpl @IrImplementationDetail constructor(
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrAnonymousInitializerSymbol,
|
||||
override var isStatic: Boolean = false,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override var isStatic: Boolean,
|
||||
override val factory: IrFactory,
|
||||
) : IrAnonymousInitializer() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@@ -25,16 +25,8 @@ open class IrClassImpl @IrImplementationDetail constructor(
|
||||
override var kind: ClassKind,
|
||||
override var visibility: DescriptorVisibility,
|
||||
override var modality: Modality,
|
||||
override var isCompanion: Boolean = false,
|
||||
override var isInner: Boolean = false,
|
||||
override var isData: Boolean = false,
|
||||
override var isExternal: Boolean = false,
|
||||
override var isValue: Boolean = false,
|
||||
override var isExpect: Boolean = false,
|
||||
override var isFun: Boolean = false,
|
||||
override var hasEnumEntries: Boolean = false,
|
||||
override val source: SourceElement = SourceElement.NO_SOURCE,
|
||||
override val factory: IrFactory = IrFactoryImpl
|
||||
override val source: SourceElement,
|
||||
override val factory: IrFactory,
|
||||
) : IrClass() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
@@ -64,4 +56,13 @@ open class IrClassImpl @IrImplementationDetail constructor(
|
||||
override var originalBeforeInline: IrAttributeContainer? = null
|
||||
|
||||
override var sealedSubclasses: List<IrClassSymbol> = emptyList()
|
||||
|
||||
override var isCompanion: Boolean = false
|
||||
override var isInner: Boolean = false
|
||||
override var isData: Boolean = false
|
||||
override var isExternal: Boolean = false
|
||||
override var isValue: Boolean = false
|
||||
override var isExpect: Boolean = false
|
||||
override var isFun: Boolean = false
|
||||
override var hasEnumEntries: Boolean = false
|
||||
}
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ class IrConstructorImpl @IrImplementationDetail constructor(
|
||||
override var isExternal: Boolean,
|
||||
override var isPrimary: Boolean,
|
||||
override var isExpect: Boolean,
|
||||
override var containerSource: DeserializedContainerSource? = null,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override var containerSource: DeserializedContainerSource?,
|
||||
override val factory: IrFactory,
|
||||
) : IrConstructor() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class IrEnumEntryImpl @IrImplementationDetail constructor(
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrEnumEntrySymbol,
|
||||
override var name: Name,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override val factory: IrFactory,
|
||||
) : IrEnumEntry() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ class IrErrorDeclarationImpl @IrImplementationDetail constructor(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
private val _descriptor: DeclarationDescriptor?,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override val factory: IrFactory,
|
||||
) : IrErrorDeclaration() {
|
||||
override val descriptor: DeclarationDescriptor
|
||||
get() = _descriptor ?: this.toIrBasedDescriptor()
|
||||
|
||||
@@ -55,10 +55,18 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
||||
source: SourceElement,
|
||||
): IrClass =
|
||||
IrClassImpl(
|
||||
startOffset, endOffset, origin, symbol, name, kind, visibility, modality,
|
||||
isCompanion, isInner, isData, isExternal, isValue, isExpect, isFun, hasEnumEntries, source,
|
||||
startOffset, endOffset, origin, symbol, name, kind, visibility, modality, source,
|
||||
factory = this
|
||||
)
|
||||
).apply {
|
||||
this.isCompanion = isCompanion
|
||||
this.isInner = isInner
|
||||
this.isData = isData
|
||||
this.isExternal = isExternal
|
||||
this.isValue = isValue
|
||||
this.isExpect = isExpect
|
||||
this.isFun = isFun
|
||||
this.hasEnumEntries = hasEnumEntries
|
||||
}
|
||||
|
||||
override fun createConstructor(
|
||||
startOffset: Int,
|
||||
|
||||
@@ -28,7 +28,7 @@ class IrFieldImpl @IrImplementationDetail constructor(
|
||||
override var isFinal: Boolean,
|
||||
override var isExternal: Boolean,
|
||||
override var isStatic: Boolean,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override val factory: IrFactory,
|
||||
) : IrField() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ class IrFunctionWithLateBindingImpl @IrImplementationDetail constructor(
|
||||
override var isOperator: Boolean,
|
||||
override var isInfix: Boolean,
|
||||
override var isExpect: Boolean,
|
||||
override var isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
override val factory: IrFactory = IrFactoryImpl
|
||||
override var isFakeOverride: Boolean,
|
||||
override val factory: IrFactory
|
||||
) : IrFunctionWithLateBinding() {
|
||||
|
||||
private var _symbol: IrSimpleFunctionSymbol? = null
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ class IrLocalDelegatedPropertyImpl @IrImplementationDetail constructor(
|
||||
override var name: Name,
|
||||
override var type: IrType,
|
||||
override var isVar: Boolean,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override val factory: IrFactory,
|
||||
) : IrLocalDelegatedProperty() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@@ -30,9 +30,9 @@ class IrPropertyImpl @IrImplementationDetail constructor(
|
||||
override var isDelegated: Boolean,
|
||||
override var isExternal: Boolean,
|
||||
override var isExpect: Boolean = false,
|
||||
override var isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
override var containerSource: DeserializedContainerSource? = null,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override var isFakeOverride: Boolean,
|
||||
override var containerSource: DeserializedContainerSource?,
|
||||
override val factory: IrFactory,
|
||||
) : IrProperty() {
|
||||
|
||||
init {
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@ class IrPropertyWithLateBindingImpl @IrImplementationDetail constructor(
|
||||
override var isDelegated: Boolean,
|
||||
override var isExternal: Boolean,
|
||||
override var isExpect: Boolean,
|
||||
override var isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override var isFakeOverride: Boolean,
|
||||
override val factory: IrFactory,
|
||||
) : IrPropertyWithLateBinding() {
|
||||
|
||||
private var _symbol: IrPropertySymbol? = null
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ class IrTypeAliasImpl @IrImplementationDetail constructor(
|
||||
override var expandedType: IrType,
|
||||
override var isActual: Boolean,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
override val factory: IrFactory,
|
||||
) : IrTypeAlias() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrClassImpl
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI
|
||||
@@ -23,7 +24,8 @@ import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled
|
||||
@OptIn(IrImplementationDetail::class)
|
||||
val IrErrorClassImpl = IrClassImpl(
|
||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.ERROR_CLASS, IrClassSymbolImpl(),
|
||||
Name.special("<error>"), ClassKind.CLASS, DescriptorVisibilities.DEFAULT_VISIBILITY, Modality.FINAL
|
||||
Name.special("<error>"), ClassKind.CLASS, DescriptorVisibilities.DEFAULT_VISIBILITY, Modality.FINAL,
|
||||
SourceElement.NO_SOURCE, IrFactoryImpl
|
||||
).apply {
|
||||
parent = ErrorFile
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user