[IR] Unbind construction methods of IrFieldImpl from symbol.descriptor
This commit is contained in:
+1
-1
@@ -133,7 +133,7 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D
|
|||||||
context.symbolTable.declareField(
|
context.symbolTable.declareField(
|
||||||
startOffset, endOffset, origin, delegateDescriptor, type
|
startOffset, endOffset, origin, delegateDescriptor, type
|
||||||
) {
|
) {
|
||||||
IrFieldImpl(startOffset, endOffset, origin, it, type).apply {
|
IrFieldImpl(startOffset, endOffset, origin, delegateDescriptor, type, symbol = it).apply {
|
||||||
metadata = MetadataSource.Property(propertyDescriptor)
|
metadata = MetadataSource.Property(propertyDescriptor)
|
||||||
}
|
}
|
||||||
}.also { irDelegate ->
|
}.also { irDelegate ->
|
||||||
|
|||||||
@@ -36,42 +36,34 @@ class IrFieldImpl(
|
|||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
origin: IrDeclarationOrigin,
|
origin: IrDeclarationOrigin,
|
||||||
override val symbol: IrFieldSymbol,
|
override val symbol: IrFieldSymbol,
|
||||||
override val name: Name = symbol.descriptor.name,
|
override val name: Name,
|
||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val visibility: Visibility = symbol.descriptor.visibility,
|
override val visibility: Visibility,
|
||||||
override val isFinal: Boolean = !symbol.descriptor.isVar,
|
override val isFinal: Boolean,
|
||||||
override val isExternal: Boolean = symbol.descriptor.isEffectivelyExternal(),
|
override val isExternal: Boolean,
|
||||||
override val isStatic: Boolean = symbol.descriptor.dispatchReceiverParameter == null,
|
override val isStatic: Boolean,
|
||||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE
|
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE
|
||||||
) : IrDeclarationBase<FieldCarrier>(startOffset, endOffset, origin),
|
) : IrDeclarationBase<FieldCarrier>(startOffset, endOffset, origin),
|
||||||
IrField,
|
IrField,
|
||||||
FieldCarrier {
|
FieldCarrier {
|
||||||
|
|
||||||
constructor(
|
|
||||||
startOffset: Int,
|
|
||||||
endOffset: Int,
|
|
||||||
origin: IrDeclarationOrigin,
|
|
||||||
symbol: IrFieldSymbol,
|
|
||||||
type: IrType,
|
|
||||||
visibility: Visibility = symbol.descriptor.visibility
|
|
||||||
) :
|
|
||||||
this(
|
|
||||||
startOffset, endOffset, origin, symbol,
|
|
||||||
symbol.descriptor.name, type, visibility,
|
|
||||||
isFinal = !symbol.descriptor.isVar,
|
|
||||||
isExternal = symbol.descriptor.isEffectivelyExternal(),
|
|
||||||
isStatic = symbol.descriptor.dispatchReceiverParameter == null,
|
|
||||||
isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE
|
|
||||||
)
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
origin: IrDeclarationOrigin,
|
origin: IrDeclarationOrigin,
|
||||||
descriptor: PropertyDescriptor,
|
descriptor: PropertyDescriptor,
|
||||||
type: IrType
|
type: IrType,
|
||||||
) :
|
name: Name = descriptor.name,
|
||||||
this(startOffset, endOffset, origin, IrFieldSymbolImpl(descriptor), type)
|
symbol: IrFieldSymbol = IrFieldSymbolImpl(descriptor),
|
||||||
|
visibility: Visibility = descriptor.visibility
|
||||||
|
) : this(
|
||||||
|
startOffset, endOffset, origin, symbol,
|
||||||
|
name = name, type,
|
||||||
|
visibility = visibility,
|
||||||
|
isFinal = !descriptor.isVar,
|
||||||
|
isExternal = descriptor.isEffectivelyExternal(),
|
||||||
|
isStatic = descriptor.dispatchReceiverParameter == null
|
||||||
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
|
|||||||
@@ -536,9 +536,12 @@ open class SymbolTable(
|
|||||||
visibility: Visibility? = null,
|
visibility: Visibility? = null,
|
||||||
fieldFactory: (IrFieldSymbol) -> IrField = {
|
fieldFactory: (IrFieldSymbol) -> IrField = {
|
||||||
IrFieldImpl(
|
IrFieldImpl(
|
||||||
startOffset, endOffset, origin, it,
|
startOffset, endOffset, origin,
|
||||||
nameProvider.nameForDeclaration(descriptor),
|
name = nameProvider.nameForDeclaration(descriptor),
|
||||||
type, visibility ?: it.descriptor.visibility,
|
type = type,
|
||||||
|
descriptor = descriptor,
|
||||||
|
symbol = it,
|
||||||
|
visibility = visibility ?: it.descriptor.visibility,
|
||||||
).apply {
|
).apply {
|
||||||
metadata = MetadataSource.Property(it.descriptor)
|
metadata = MetadataSource.Property(it.descriptor)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -234,7 +234,7 @@ interface IrBuilderExtension {
|
|||||||
|
|
||||||
return originProperty.run {
|
return originProperty.run {
|
||||||
// TODO: type parameters
|
// TODO: type parameters
|
||||||
IrFieldImpl(startOffset, endOffset, SERIALIZABLE_PLUGIN_ORIGIN, fieldSymbol, propertyDescriptor.type.toIrType())
|
IrFieldImpl(startOffset, endOffset, SERIALIZABLE_PLUGIN_ORIGIN, propertyDescriptor, propertyDescriptor.type.toIrType(), symbol = fieldSymbol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user