Call IrSymbol.bind in declaration constructors
This commit is contained in:
@@ -45,7 +45,6 @@ class SymbolTable {
|
||||
inline fun declare(d: D, createSymbol: () -> S, createOwner: (S) -> B): B {
|
||||
val symbol = getOrCreateSymbol(d, createSymbol)
|
||||
val owner = createOwner(symbol)
|
||||
symbol.bind(owner)
|
||||
return owner
|
||||
}
|
||||
|
||||
@@ -128,7 +127,6 @@ class SymbolTable {
|
||||
val scope = currentScope ?: throw AssertionError("No active scope")
|
||||
val symbol = scope.getLocal(d) ?: createSymbol().also { scope[d] = it }
|
||||
val owner = createOwner(symbol)
|
||||
symbol.bind(owner)
|
||||
return owner
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -41,6 +41,10 @@ class IrAnonymousInitializerImpl(
|
||||
this.body = body
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
||||
|
||||
override lateinit var body: IrBlockBody
|
||||
|
||||
@@ -43,6 +43,10 @@ class IrClassImpl(
|
||||
addAll(members)
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
||||
|
||||
override var newInstanceReceiver: IrValueParameter? = null
|
||||
|
||||
@@ -42,6 +42,10 @@ class IrConstructorImpl(
|
||||
this.body = body
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val descriptor: ClassConstructorDescriptor get() = symbol.descriptor
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||
|
||||
@@ -44,6 +44,10 @@ class IrEnumEntryImpl(
|
||||
this.initializerExpression = initializerExpression
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val descriptor: ClassDescriptor get() = symbol.descriptor
|
||||
override var correspondingClass: IrClass? = null
|
||||
override var initializerExpression: IrExpression? = null
|
||||
|
||||
+4
@@ -28,6 +28,10 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
class IrExternalPackageFragmentImpl(
|
||||
override val symbol: IrExternalPackageFragmentSymbol
|
||||
) : IrExternalPackageFragment, IrElementBase(UNDEFINED_OFFSET, UNDEFINED_OFFSET) {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val packageFragmentDescriptor: PackageFragmentDescriptor get() = symbol.descriptor
|
||||
|
||||
override val declarations: MutableList<IrDeclaration> = ArrayList()
|
||||
|
||||
@@ -42,6 +42,10 @@ class IrFieldImpl(
|
||||
this.initializer = initializer
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val descriptor: PropertyDescriptor = symbol.descriptor
|
||||
|
||||
override var initializer: IrExpressionBody? = null
|
||||
|
||||
@@ -46,6 +46,10 @@ class IrFileImpl(
|
||||
this.declarations.addAll(declarations)
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val packageFragmentDescriptor: PackageFragmentDescriptor get() = symbol.descriptor
|
||||
|
||||
override val fileAnnotations: MutableList<AnnotationDescriptor> = SmartList()
|
||||
|
||||
@@ -45,6 +45,10 @@ class IrFunctionImpl(
|
||||
this.body = body
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitSimpleFunction(this, data)
|
||||
}
|
||||
+4
@@ -35,6 +35,10 @@ class IrTypeParameterImpl(
|
||||
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: TypeParameterDescriptor) :
|
||||
this(startOffset, endOffset, origin, IrTypeParameterSymbolImpl(descriptor))
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitTypeParameter(this, data)
|
||||
|
||||
|
||||
+4
@@ -46,6 +46,10 @@ class IrValueParameterImpl(
|
||||
this.defaultValue = defaultValue
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var defaultValue: IrExpressionBody? = null
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
|
||||
@@ -44,6 +44,10 @@ class IrVariableImpl(
|
||||
this.initializer = initializer
|
||||
}
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override val descriptor: VariableDescriptor get() = symbol.descriptor
|
||||
|
||||
override var initializer: IrExpression? = null
|
||||
|
||||
@@ -66,7 +66,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
IrExternalPackageFragmentImpl(
|
||||
symbolsRemapper.getDeclaredExternalPackageFragment(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
declaration.transformDeclarationsTo(this)
|
||||
}
|
||||
|
||||
@@ -75,7 +74,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
declaration.fileEntry,
|
||||
symbolsRemapper.getDeclaredFile(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
fileAnnotations.addAll(declaration.fileAnnotations)
|
||||
declaration.transformDeclarationsTo(this)
|
||||
}
|
||||
@@ -89,7 +87,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredClass(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
newInstanceReceiver = declaration.newInstanceReceiver?.transform()
|
||||
declaration.typeParameters.transformTo(typeParameters)
|
||||
declaration.transformDeclarationsTo(this)
|
||||
@@ -108,7 +105,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredFunction(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
transformFunctionChildren(declaration)
|
||||
}
|
||||
|
||||
@@ -118,7 +114,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredConstructor(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
transformFunctionChildren(declaration)
|
||||
}
|
||||
|
||||
@@ -148,7 +143,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredField(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
initializer = declaration.initializer?.transform()
|
||||
}
|
||||
|
||||
@@ -168,7 +162,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredEnumEntry(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
correspondingClass = declaration.correspondingClass?.transform()
|
||||
initializerExpression = declaration.initializerExpression?.transform()
|
||||
}
|
||||
@@ -179,7 +172,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
IrAnonymousInitializerSymbolImpl(declaration.descriptor)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
body = declaration.body.transform()
|
||||
}
|
||||
|
||||
@@ -189,7 +181,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredVariable(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
initializer = declaration.initializer?.transform()
|
||||
}
|
||||
|
||||
@@ -198,9 +189,7 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
declaration.startOffset, declaration.endOffset,
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredTypeParameter(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
}
|
||||
)
|
||||
|
||||
override fun visitValueParameter(declaration: IrValueParameter): IrValueParameter =
|
||||
IrValueParameterImpl(
|
||||
@@ -208,7 +197,6 @@ class DeepCopyIrTree(private val symbolsRemapper: DeepCopySymbolsRemapper) : IrE
|
||||
mapDeclarationOrigin(declaration.origin),
|
||||
symbolsRemapper.getDeclaredValueParameter(declaration.symbol)
|
||||
).apply {
|
||||
symbol.bind(this)
|
||||
defaultValue = declaration.defaultValue?.transform()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user