[IR] Unbind construction methods of IrLocalDelegatedPropertyImpl from symbol.descriptor

This commit is contained in:
Mikhail Glukhikh
2020-05-19 15:47:06 +03:00
parent 58ef59074d
commit c68de4639f
3 changed files with 10 additions and 62 deletions
@@ -32,9 +32,9 @@ class IrLocalDelegatedPropertyImpl(
endOffset: Int,
origin: IrDeclarationOrigin,
override val symbol: IrLocalDelegatedPropertySymbol,
override val name: Name = symbol.descriptor.name,
override val name: Name,
override val type: IrType,
override val isVar: Boolean = symbol.descriptor.isVar
override val isVar: Boolean
) :
IrDeclarationBase<LocalDelegatedPropertyCarrier>(startOffset, endOffset, origin),
IrLocalDelegatedProperty,
@@ -44,63 +44,6 @@ class IrLocalDelegatedPropertyImpl(
symbol.bind(this)
}
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
symbol: IrLocalDelegatedPropertySymbol,
type: IrType
) : this(
startOffset, endOffset, origin, symbol,
symbol.descriptor.name,
type,
symbol.descriptor.isVar
)
@Deprecated("Creates unbound symbol")
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: VariableDescriptorWithAccessors,
name: Name,
type: IrType,
isVar: Boolean
) : this(
startOffset, endOffset, origin,
IrLocalDelegatedPropertySymbolImpl(descriptor),
name, type, isVar
)
@Deprecated("Creates unbound symbol")
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: VariableDescriptorWithAccessors,
type: IrType
) : this(
startOffset, endOffset, origin,
IrLocalDelegatedPropertySymbolImpl(descriptor),
descriptor.name, type, descriptor.isVar
)
@Deprecated("Creates unbound symbol")
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: VariableDescriptorWithAccessors,
type: IrType,
delegate: IrVariable,
getter: IrFunction,
setter: IrFunction?
) : this(startOffset, endOffset, origin, descriptor, type) {
this.delegate = delegate
this.getter = getter
this.setter = setter
}
override val descriptor: VariableDescriptorWithAccessors
get() = symbol.descriptor
@@ -257,7 +257,9 @@ open class DeepCopyIrTreeWithSymbols(
declaration.startOffset, declaration.endOffset,
mapDeclarationOrigin(declaration.origin),
symbolRemapper.getDeclaredLocalDelegatedProperty(declaration.symbol),
declaration.type.remapType()
declaration.name,
declaration.type.remapType(),
declaration.isVar
).apply {
transformAnnotations(declaration)
delegate = declaration.delegate.transform()
@@ -875,8 +875,11 @@ open class SymbolTable(
localDelegatedPropertySymbolTable.declareLocal(
descriptor,
{ IrLocalDelegatedPropertySymbolImpl(descriptor) },
{ IrLocalDelegatedPropertyImpl(startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor), type) }
)
) {
IrLocalDelegatedPropertyImpl(
startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor), type, descriptor.isVar
)
}
fun referenceLocalDelegatedProperty(descriptor: VariableDescriptorWithAccessors) =
localDelegatedPropertySymbolTable.referenced(descriptor) {