FIR: set dispatch receiver parameter for inner class's constructor.
This commit is contained in:
committed by
Mikhail Glukhikh
parent
4558d48481
commit
cdf5a2a5a1
+13
-4
@@ -331,10 +331,10 @@ class Fir2IrDeclarationStorage(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (function !is FirConstructor) {
|
||||
with(classifierStorage) {
|
||||
val thisOrigin = IrDeclarationOrigin.DEFINED
|
||||
val receiverTypeRef = if (function !is FirPropertyAccessor) function?.receiverTypeRef else parentPropertyReceiverType
|
||||
with(classifierStorage) {
|
||||
if (function !is FirConstructor) {
|
||||
val receiverTypeRef = if (function !is FirPropertyAccessor) function?.receiverTypeRef else parentPropertyReceiverType
|
||||
if (receiverTypeRef != null) {
|
||||
extensionReceiverParameter = receiverTypeRef.convertWithOffsets { startOffset, endOffset ->
|
||||
declareThisReceiverParameter(
|
||||
@@ -353,6 +353,15 @@ class Fir2IrDeclarationStorage(
|
||||
thisOrigin = thisOrigin
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// Set dispatch receiver parameter for inner class's constructor.
|
||||
if (containingClass?.isInner == true) {
|
||||
dispatchReceiverParameter = declareThisReceiverParameter(
|
||||
parent,
|
||||
thisType = containingClass.thisReceiver!!.type,
|
||||
thisOrigin = thisOrigin
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,7 +487,7 @@ class Fir2IrDeclarationStorage(
|
||||
isInline = false, isExternal = false, isPrimary = isPrimary, isExpect = false
|
||||
).apply {
|
||||
enterScope(descriptor)
|
||||
}.bindAndDeclareParameters(constructor, descriptor, irParent, isStatic = true).apply {
|
||||
}.bindAndDeclareParameters(constructor, descriptor, irParent, isStatic = false).apply {
|
||||
leaveScope(descriptor)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user