[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(
|
||||
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)
|
||||
}
|
||||
}.also { irDelegate ->
|
||||
|
||||
@@ -36,42 +36,34 @@ class IrFieldImpl(
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrFieldSymbol,
|
||||
override val name: Name = symbol.descriptor.name,
|
||||
override val name: Name,
|
||||
override val type: IrType,
|
||||
override val visibility: Visibility = symbol.descriptor.visibility,
|
||||
override val isFinal: Boolean = !symbol.descriptor.isVar,
|
||||
override val isExternal: Boolean = symbol.descriptor.isEffectivelyExternal(),
|
||||
override val isStatic: Boolean = symbol.descriptor.dispatchReceiverParameter == null,
|
||||
override val visibility: Visibility,
|
||||
override val isFinal: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isStatic: Boolean,
|
||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE
|
||||
) : IrDeclarationBase<FieldCarrier>(startOffset, endOffset, origin),
|
||||
IrField,
|
||||
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(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
descriptor: PropertyDescriptor,
|
||||
type: IrType
|
||||
) :
|
||||
this(startOffset, endOffset, origin, IrFieldSymbolImpl(descriptor), type)
|
||||
type: IrType,
|
||||
name: Name = descriptor.name,
|
||||
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 {
|
||||
symbol.bind(this)
|
||||
|
||||
@@ -536,9 +536,12 @@ open class SymbolTable(
|
||||
visibility: Visibility? = null,
|
||||
fieldFactory: (IrFieldSymbol) -> IrField = {
|
||||
IrFieldImpl(
|
||||
startOffset, endOffset, origin, it,
|
||||
nameProvider.nameForDeclaration(descriptor),
|
||||
type, visibility ?: it.descriptor.visibility,
|
||||
startOffset, endOffset, origin,
|
||||
name = nameProvider.nameForDeclaration(descriptor),
|
||||
type = type,
|
||||
descriptor = descriptor,
|
||||
symbol = it,
|
||||
visibility = visibility ?: it.descriptor.visibility,
|
||||
).apply {
|
||||
metadata = MetadataSource.Property(it.descriptor)
|
||||
}
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ interface IrBuilderExtension {
|
||||
|
||||
return originProperty.run {
|
||||
// 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