[IR] Reorder parameters in IrFactory#createProperty
This is to prepare for IrFactory auto-generation (KT-59308).
This commit is contained in:
committed by
Space Team
parent
cd3237295b
commit
30cd2c3025
+8
-4
@@ -929,16 +929,20 @@ class Fir2IrDeclarationStorage(
|
||||
val result = declareIrProperty(signature) { symbol ->
|
||||
classifierStorage.preCacheTypeParameters(property, symbol)
|
||||
irFactory.createProperty(
|
||||
startOffset, endOffset, origin, symbol,
|
||||
property.name, components.visibilityConverter.convertToDescriptorVisibility(property.visibility), property.modality!!,
|
||||
startOffset = startOffset,
|
||||
endOffset = endOffset,
|
||||
origin = origin,
|
||||
name = property.name,
|
||||
visibility = components.visibilityConverter.convertToDescriptorVisibility(property.visibility),
|
||||
modality = property.modality!!,
|
||||
symbol = symbol,
|
||||
isVar = property.isVar,
|
||||
isConst = property.isConst,
|
||||
isLateinit = property.isLateInit,
|
||||
isDelegated = property.delegate != null,
|
||||
isExternal = property.isExternal,
|
||||
isExpect = property.isExpect,
|
||||
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
containerSource = property.containerSource,
|
||||
isExpect = property.isExpect,
|
||||
).apply {
|
||||
metadata = FirMetadataSource.Property(property)
|
||||
convertAnnotationsForNonDeclaredMembers(property, origin)
|
||||
|
||||
+5
-2
@@ -422,16 +422,19 @@ class IrDescriptorBasedFunctionFactory(
|
||||
fun createFakeOverrideProperty(descriptor: PropertyDescriptor): IrProperty {
|
||||
return symbolTable.declareProperty(offset, offset, memberOrigin, descriptor) {
|
||||
irFactory.createProperty(
|
||||
offset, offset, memberOrigin, it,
|
||||
startOffset = offset,
|
||||
endOffset = offset,
|
||||
origin = memberOrigin,
|
||||
name = descriptor.name,
|
||||
visibility = descriptor.visibility,
|
||||
modality = descriptor.modality,
|
||||
symbol = it,
|
||||
isVar = descriptor.isVar,
|
||||
isConst = descriptor.isConst,
|
||||
isLateinit = descriptor.isLateInit,
|
||||
isDelegated = descriptor.isDelegated,
|
||||
isExternal = descriptor.isEffectivelyExternal(),
|
||||
isExpect = descriptor.isExpect
|
||||
isExpect = descriptor.isExpect,
|
||||
).apply {
|
||||
parent = this@addFakeOverrides
|
||||
getter = descriptor.getter?.let { g -> createFakeOverrideFunction(g, symbol) }
|
||||
|
||||
+13
-14
@@ -576,20 +576,19 @@ internal class ReflectionReferencesGenerator(statementGenerator: StatementGenera
|
||||
val offset = UNDEFINED_OFFSET
|
||||
context.symbolTable.declareProperty(offset, offset, IrDeclarationOrigin.SYNTHETIC_JAVA_PROPERTY_DELEGATE, descriptor) {
|
||||
context.irFactory.createProperty(
|
||||
offset,
|
||||
offset,
|
||||
IrDeclarationOrigin.SYNTHETIC_JAVA_PROPERTY_DELEGATE,
|
||||
symbol,
|
||||
descriptor.name,
|
||||
descriptor.visibility,
|
||||
descriptor.modality,
|
||||
descriptor.isVar,
|
||||
descriptor.isConst,
|
||||
descriptor.isLateInit,
|
||||
descriptor.isDelegated,
|
||||
descriptor.isExternal,
|
||||
descriptor.isExpect,
|
||||
isFakeOverride = false
|
||||
startOffset = offset,
|
||||
endOffset = offset,
|
||||
origin = IrDeclarationOrigin.SYNTHETIC_JAVA_PROPERTY_DELEGATE,
|
||||
name = descriptor.name,
|
||||
visibility = descriptor.visibility,
|
||||
modality = descriptor.modality,
|
||||
symbol = symbol,
|
||||
isVar = descriptor.isVar,
|
||||
isConst = descriptor.isConst,
|
||||
isLateinit = descriptor.isLateInit,
|
||||
isDelegated = descriptor.isDelegated,
|
||||
isExternal = descriptor.isExternal,
|
||||
isExpect = descriptor.isExpect,
|
||||
).also {
|
||||
it.parent = scope.getLocalDeclarationParent()
|
||||
}
|
||||
|
||||
+5
-2
@@ -242,16 +242,19 @@ internal class StandaloneDeclarationGenerator(private val context: GeneratorCont
|
||||
startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: PropertyDescriptor, symbol: IrPropertySymbol
|
||||
): IrProperty {
|
||||
val irProperty = irFactory.createProperty(
|
||||
startOffset, endOffset, origin, symbol,
|
||||
startOffset = startOffset,
|
||||
endOffset = endOffset,
|
||||
origin = origin,
|
||||
name = descriptor.name,
|
||||
visibility = descriptor.visibility,
|
||||
modality = descriptor.modality,
|
||||
symbol = symbol,
|
||||
isVar = descriptor.isVar,
|
||||
isConst = descriptor.isConst,
|
||||
isLateinit = descriptor.isLateInit,
|
||||
isDelegated = false,
|
||||
isExternal = descriptor.isEffectivelyExternal(),
|
||||
isExpect = descriptor.isExpect
|
||||
isExpect = descriptor.isExpect,
|
||||
)
|
||||
|
||||
irProperty.metadata = DescriptorMetadataSource.Property(descriptor)
|
||||
|
||||
+15
-5
@@ -98,11 +98,21 @@ fun IrClass.addField(
|
||||
@PublishedApi
|
||||
internal fun IrFactory.buildProperty(builder: IrPropertyBuilder): IrProperty = with(builder) {
|
||||
createProperty(
|
||||
startOffset, endOffset, origin,
|
||||
IrPropertySymbolImpl(),
|
||||
name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, isFakeOverride,
|
||||
containerSource,
|
||||
startOffset = startOffset,
|
||||
endOffset = endOffset,
|
||||
origin = origin,
|
||||
name = name,
|
||||
visibility = visibility,
|
||||
modality = modality,
|
||||
symbol = IrPropertySymbolImpl(),
|
||||
isVar = isVar,
|
||||
isConst = isConst,
|
||||
isLateinit = isLateinit,
|
||||
isDelegated = isDelegated,
|
||||
isExternal = isExternal,
|
||||
containerSource = containerSource,
|
||||
isExpect = isExpect,
|
||||
isFakeOverride = isFakeOverride,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -139,18 +139,18 @@ interface IrFactory {
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
symbol: IrPropertySymbol,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
containerSource: DeserializedContainerSource? = null,
|
||||
isExpect: Boolean = false,
|
||||
isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
containerSource: DeserializedContainerSource? = null
|
||||
isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE
|
||||
): IrProperty
|
||||
|
||||
fun createPropertyWithLateBinding(
|
||||
|
||||
@@ -169,18 +169,18 @@ abstract class AbstractIrFactoryImpl : IrFactory {
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
symbol: IrPropertySymbol,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
): IrProperty =
|
||||
IrPropertyImpl(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality,
|
||||
|
||||
+5
-5
@@ -258,35 +258,35 @@ class IrFactoryImplForJsIC(override val stageController: StageController) : Abst
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
symbol: IrPropertySymbol,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
containerSource: DeserializedContainerSource?
|
||||
isFakeOverride: Boolean
|
||||
): IrProperty {
|
||||
return super.createProperty(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
visibility,
|
||||
modality,
|
||||
symbol,
|
||||
isVar,
|
||||
isConst,
|
||||
isLateinit,
|
||||
isDelegated,
|
||||
isExternal,
|
||||
containerSource,
|
||||
isExpect,
|
||||
isFakeOverride,
|
||||
containerSource,
|
||||
).register()
|
||||
}
|
||||
|
||||
|
||||
@@ -147,24 +147,37 @@ class LazyIrFactory(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
symbol: IrPropertySymbol,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
containerSource: DeserializedContainerSource?
|
||||
isFakeOverride: Boolean
|
||||
): IrProperty = if (symbol.isBound)
|
||||
symbol.owner
|
||||
else
|
||||
delegate.createProperty(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, isFakeOverride, containerSource
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
name,
|
||||
visibility,
|
||||
modality,
|
||||
symbol,
|
||||
isVar,
|
||||
isConst,
|
||||
isLateinit,
|
||||
isDelegated,
|
||||
isExternal,
|
||||
containerSource,
|
||||
isExpect,
|
||||
isFakeOverride,
|
||||
)
|
||||
|
||||
override fun createTypeAlias(
|
||||
|
||||
@@ -235,19 +235,20 @@ open class DeepCopyIrTreeWithSymbols(
|
||||
|
||||
override fun visitProperty(declaration: IrProperty): IrProperty =
|
||||
declaration.factory.createProperty(
|
||||
declaration.startOffset, declaration.endOffset,
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolRemapper.getDeclaredProperty(declaration.symbol),
|
||||
declaration.name,
|
||||
declaration.visibility,
|
||||
declaration.modality,
|
||||
startOffset = declaration.startOffset,
|
||||
endOffset = declaration.endOffset,
|
||||
origin = mapDeclarationOrigin(declaration.origin),
|
||||
name = declaration.name,
|
||||
visibility = declaration.visibility,
|
||||
modality = declaration.modality,
|
||||
symbol = symbolRemapper.getDeclaredProperty(declaration.symbol),
|
||||
isVar = declaration.isVar,
|
||||
isConst = declaration.isConst,
|
||||
isLateinit = declaration.isLateinit,
|
||||
isDelegated = declaration.isDelegated,
|
||||
isExternal = declaration.isExternal,
|
||||
isExpect = declaration.isExpect,
|
||||
containerSource = declaration.containerSource,
|
||||
isExpect = declaration.isExpect,
|
||||
).apply {
|
||||
transformAnnotations(declaration)
|
||||
copyAttributes(declaration)
|
||||
|
||||
@@ -798,16 +798,20 @@ open class SymbolTable(
|
||||
isDelegated: Boolean = descriptor.isDelegated,
|
||||
propertyFactory: (IrPropertySymbol) -> IrProperty = { symbol ->
|
||||
irFactory.createProperty(
|
||||
startOffset, endOffset, origin, symbol, name = nameProvider.nameForDeclaration(descriptor),
|
||||
startOffset = startOffset,
|
||||
endOffset = endOffset,
|
||||
origin = origin,
|
||||
name = nameProvider.nameForDeclaration(descriptor),
|
||||
visibility = descriptor.visibility,
|
||||
modality = descriptor.modality,
|
||||
symbol = symbol,
|
||||
isVar = descriptor.isVar,
|
||||
isConst = descriptor.isConst,
|
||||
isLateinit = descriptor.isLateInit,
|
||||
isDelegated = isDelegated,
|
||||
isExternal = descriptor.isEffectivelyExternal(),
|
||||
isExpect = descriptor.isExpect,
|
||||
isFakeOverride = descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE
|
||||
isFakeOverride = descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE,
|
||||
).apply {
|
||||
metadata = DescriptorMetadataSource.Property(symbol.descriptor)
|
||||
}
|
||||
|
||||
+1
-1
@@ -121,10 +121,10 @@ internal class MissingDeclarationStubGenerator(private val builtIns: IrBuiltIns)
|
||||
startOffset = UNDEFINED_OFFSET,
|
||||
endOffset = UNDEFINED_OFFSET,
|
||||
origin = PartiallyLinkedDeclarationOrigin.MISSING_DECLARATION,
|
||||
symbol = symbol,
|
||||
name = symbol.guessName(),
|
||||
visibility = DescriptorVisibilities.DEFAULT_VISIBILITY,
|
||||
modality = Modality.FINAL,
|
||||
symbol = symbol,
|
||||
isVar = false,
|
||||
isConst = false,
|
||||
isLateinit = false,
|
||||
|
||||
+14
-12
@@ -753,18 +753,20 @@ class IrDeclarationDeserializer(
|
||||
val propertySymbol: IrPropertySymbol = symbol.checkSymbolType(PROPERTY_SYMBOL)
|
||||
val prop = symbolTable.declareProperty(uniqId, { propertySymbol }) {
|
||||
irFactory.createProperty(
|
||||
startOffset, endOffset, origin,
|
||||
it,
|
||||
deserializeName(proto.name),
|
||||
flags.visibility,
|
||||
flags.modality,
|
||||
flags.isVar,
|
||||
flags.isConst,
|
||||
flags.isLateinit,
|
||||
flags.isDelegated,
|
||||
flags.isExternal || isEffectivelyExternal,
|
||||
flags.isExpect,
|
||||
flags.isFakeOverride
|
||||
startOffset = startOffset,
|
||||
endOffset = endOffset,
|
||||
origin = origin,
|
||||
name = deserializeName(proto.name),
|
||||
visibility = flags.visibility,
|
||||
modality = flags.modality,
|
||||
symbol = it,
|
||||
isVar = flags.isVar,
|
||||
isConst = flags.isConst,
|
||||
isLateinit = flags.isLateinit,
|
||||
isDelegated = flags.isDelegated,
|
||||
isExternal = flags.isExternal || isEffectivelyExternal,
|
||||
isExpect = flags.isExpect,
|
||||
isFakeOverride = flags.isFakeOverride,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user