IR: remove deprecated constructor of IrFieldImpl
This commit is contained in:
+4
-1
@@ -133,7 +133,10 @@ 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, delegateDescriptor, type, symbol = it).apply {
|
IrFieldImpl(
|
||||||
|
startOffset, endOffset, origin, it, delegateDescriptor.name, type, delegateDescriptor.visibility,
|
||||||
|
!delegateDescriptor.isVar, false, delegateDescriptor.dispatchReceiverParameter == null
|
||||||
|
).apply {
|
||||||
metadata = MetadataSource.Property(propertyDescriptor)
|
metadata = MetadataSource.Property(propertyDescriptor)
|
||||||
}
|
}
|
||||||
}.also { irDelegate ->
|
}.also { irDelegate ->
|
||||||
|
|||||||
@@ -19,18 +19,17 @@ package org.jetbrains.kotlin.ir.declarations.impl
|
|||||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.Visibility
|
import org.jetbrains.kotlin.descriptors.Visibility
|
||||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrField
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.carriers.FieldCarrier
|
import org.jetbrains.kotlin.ir.declarations.impl.carriers.FieldCarrier
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
|
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
|
|
||||||
|
|
||||||
|
|
||||||
class IrFieldImpl(
|
class IrFieldImpl(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
@@ -47,24 +46,6 @@ class IrFieldImpl(
|
|||||||
IrField,
|
IrField,
|
||||||
FieldCarrier {
|
FieldCarrier {
|
||||||
|
|
||||||
constructor(
|
|
||||||
startOffset: Int,
|
|
||||||
endOffset: Int,
|
|
||||||
origin: IrDeclarationOrigin,
|
|
||||||
descriptor: PropertyDescriptor,
|
|
||||||
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 {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -582,12 +582,9 @@ open class SymbolTable(
|
|||||||
visibility: Visibility? = null,
|
visibility: Visibility? = null,
|
||||||
fieldFactory: (IrFieldSymbol) -> IrField = {
|
fieldFactory: (IrFieldSymbol) -> IrField = {
|
||||||
IrFieldImpl(
|
IrFieldImpl(
|
||||||
startOffset, endOffset, origin,
|
startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor), type,
|
||||||
name = nameProvider.nameForDeclaration(descriptor),
|
visibility ?: it.descriptor.visibility, !it.descriptor.isVar, it.descriptor.isEffectivelyExternal(),
|
||||||
type = type,
|
it.descriptor.dispatchReceiverParameter == null
|
||||||
descriptor = descriptor,
|
|
||||||
symbol = it,
|
|
||||||
visibility = visibility ?: it.descriptor.visibility,
|
|
||||||
).apply {
|
).apply {
|
||||||
metadata = MetadataSource.Property(it.descriptor)
|
metadata = MetadataSource.Property(it.descriptor)
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-5
@@ -26,6 +26,7 @@ import org.jetbrains.kotlin.js.resolve.diagnostics.findPsi
|
|||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
|
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||||
|
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.typeUtil.isTypeParameter
|
import org.jetbrains.kotlin.types.typeUtil.isTypeParameter
|
||||||
@@ -259,16 +260,18 @@ interface IrBuilderExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun generatePropertyBackingField(
|
private fun generatePropertyBackingField(
|
||||||
propertyDescriptor: PropertyDescriptor,
|
descriptor: PropertyDescriptor,
|
||||||
originProperty: IrProperty
|
originProperty: IrProperty
|
||||||
): IrField {
|
): IrField {
|
||||||
val fieldSymbol = compilerContext.symbolTable.referenceField(propertyDescriptor)
|
val fieldSymbol = compilerContext.symbolTable.referenceField(descriptor)
|
||||||
|
|
||||||
if (fieldSymbol.isBound) return fieldSymbol.owner
|
if (fieldSymbol.isBound) return fieldSymbol.owner
|
||||||
|
|
||||||
return originProperty.run {
|
return with(descriptor) {
|
||||||
// TODO: type parameters
|
// TODO: type parameters
|
||||||
IrFieldImpl(startOffset, endOffset, SERIALIZABLE_PLUGIN_ORIGIN, propertyDescriptor, propertyDescriptor.type.toIrType(), symbol = fieldSymbol)
|
IrFieldImpl(
|
||||||
|
originProperty.startOffset, originProperty.endOffset, SERIALIZABLE_PLUGIN_ORIGIN, fieldSymbol, name, type.toIrType(),
|
||||||
|
visibility, !isVar, isEffectivelyExternal(), dispatchReceiverParameter == null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user