[K/N][IR] Replaced lazyMapMember with mapping
This commit is contained in:
+36
-91
@@ -8,17 +8,14 @@ package org.jetbrains.kotlin.backend.konan
|
|||||||
import llvm.*
|
import llvm.*
|
||||||
import org.jetbrains.kotlin.backend.konan.ir.KonanSymbols
|
import org.jetbrains.kotlin.backend.konan.ir.KonanSymbols
|
||||||
import org.jetbrains.kotlin.backend.konan.llvm.*
|
import org.jetbrains.kotlin.backend.konan.llvm.*
|
||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
import org.jetbrains.kotlin.backend.common.getOrPut
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
|
||||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||||
|
import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter
|
||||||
|
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrValueParameterImpl
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
import org.jetbrains.kotlin.ir.expressions.IrConstKind
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrConstantPrimitive
|
import org.jetbrains.kotlin.ir.expressions.IrConstantPrimitive
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
|
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.util.defaultOrNullableType
|
import org.jetbrains.kotlin.ir.util.defaultOrNullableType
|
||||||
import org.jetbrains.kotlin.ir.util.defaultType
|
import org.jetbrains.kotlin.ir.util.defaultType
|
||||||
@@ -45,9 +42,9 @@ private fun KonanSymbols.getTypeConversionImpl(
|
|||||||
|
|
||||||
internal object DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION : IrDeclarationOriginImpl("INLINE_CLASS_SPECIAL_FUNCTION")
|
internal object DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION : IrDeclarationOriginImpl("INLINE_CLASS_SPECIAL_FUNCTION")
|
||||||
|
|
||||||
internal val Context.getBoxFunction: (IrClass) -> IrSimpleFunction by Context.lazyMapMember { inlinedClass ->
|
internal fun Context.getBoxFunction(inlinedClass: IrClass): IrSimpleFunction = mapping.boxFunctions.getOrPut(inlinedClass) {
|
||||||
require(inlinedClass.isUsedAsBoxClass())
|
require(inlinedClass.isUsedAsBoxClass())
|
||||||
val classes = mutableListOf<IrClass>(inlinedClass)
|
val classes = mutableListOf(inlinedClass)
|
||||||
var parent = inlinedClass.parent
|
var parent = inlinedClass.parent
|
||||||
while (parent is IrClass) {
|
while (parent is IrClass) {
|
||||||
classes.add(parent)
|
classes.add(parent)
|
||||||
@@ -55,58 +52,31 @@ internal val Context.getBoxFunction: (IrClass) -> IrSimpleFunction by Context.la
|
|||||||
}
|
}
|
||||||
require(parent is IrFile || parent is IrExternalPackageFragment) { "Local inline classes are not supported" }
|
require(parent is IrFile || parent is IrExternalPackageFragment) { "Local inline classes are not supported" }
|
||||||
|
|
||||||
val symbols = ir.symbols
|
|
||||||
|
|
||||||
val isNullable = inlinedClass.inlinedClassIsNullable()
|
val isNullable = inlinedClass.inlinedClassIsNullable()
|
||||||
val unboxedType = inlinedClass.defaultOrNullableType(isNullable)
|
val unboxedType = inlinedClass.defaultOrNullableType(isNullable)
|
||||||
val boxedType = symbols.any.owner.defaultOrNullableType(isNullable)
|
val boxedType = ir.symbols.any.owner.defaultOrNullableType(isNullable)
|
||||||
|
|
||||||
val parameterType = unboxedType
|
irFactory.buildFun {
|
||||||
val returnType = boxedType
|
startOffset = inlinedClass.startOffset
|
||||||
|
endOffset = inlinedClass.endOffset
|
||||||
val startOffset = inlinedClass.startOffset
|
origin = DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION
|
||||||
val endOffset = inlinedClass.endOffset
|
name = Name.special("<${classes.reversed().joinToString(".") { it.name.asString() }}-box>")
|
||||||
|
returnType = boxedType
|
||||||
IrFunctionImpl(
|
}.also { function ->
|
||||||
startOffset, endOffset,
|
|
||||||
DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION,
|
|
||||||
IrSimpleFunctionSymbolImpl(),
|
|
||||||
Name.special("<${classes.reversed().joinToString(".") { it.name.asString() }}-box>"),
|
|
||||||
DescriptorVisibilities.PUBLIC,
|
|
||||||
Modality.FINAL,
|
|
||||||
returnType,
|
|
||||||
isInline = false,
|
|
||||||
isExternal = false,
|
|
||||||
isTailrec = false,
|
|
||||||
isSuspend = false,
|
|
||||||
isExpect = false,
|
|
||||||
isFakeOverride = false,
|
|
||||||
isOperator = false,
|
|
||||||
isInfix = false
|
|
||||||
).also { function ->
|
|
||||||
function.valueParameters = listOf(
|
|
||||||
IrValueParameterImpl(
|
|
||||||
startOffset, endOffset,
|
|
||||||
IrDeclarationOrigin.DEFINED,
|
|
||||||
IrValueParameterSymbolImpl(),
|
|
||||||
Name.identifier("value"),
|
|
||||||
index = 0,
|
|
||||||
varargElementType = null,
|
|
||||||
isCrossinline = false,
|
|
||||||
type = parameterType,
|
|
||||||
isNoinline = false,
|
|
||||||
isHidden = false,
|
|
||||||
isAssignable = false
|
|
||||||
).also {
|
|
||||||
it.parent = function
|
|
||||||
})
|
|
||||||
function.parent = parent
|
function.parent = parent
|
||||||
|
|
||||||
|
function.addValueParameter {
|
||||||
|
startOffset = inlinedClass.startOffset
|
||||||
|
endOffset = inlinedClass.endOffset
|
||||||
|
name = Name.identifier("value")
|
||||||
|
type = unboxedType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val Context.getUnboxFunction: (IrClass) -> IrSimpleFunction by Context.lazyMapMember { inlinedClass ->
|
internal fun Context.getUnboxFunction(inlinedClass: IrClass): IrSimpleFunction = mapping.unboxFunctions.getOrPut(inlinedClass) {
|
||||||
require(inlinedClass.isUsedAsBoxClass())
|
require(inlinedClass.isUsedAsBoxClass())
|
||||||
val classes = mutableListOf<IrClass>(inlinedClass)
|
val classes = mutableListOf(inlinedClass)
|
||||||
var parent = inlinedClass.parent
|
var parent = inlinedClass.parent
|
||||||
while (parent is IrClass) {
|
while (parent is IrClass) {
|
||||||
classes.add(parent)
|
classes.add(parent)
|
||||||
@@ -120,46 +90,21 @@ internal val Context.getUnboxFunction: (IrClass) -> IrSimpleFunction by Context.
|
|||||||
val unboxedType = inlinedClass.defaultOrNullableType(isNullable)
|
val unboxedType = inlinedClass.defaultOrNullableType(isNullable)
|
||||||
val boxedType = symbols.any.owner.defaultOrNullableType(isNullable)
|
val boxedType = symbols.any.owner.defaultOrNullableType(isNullable)
|
||||||
|
|
||||||
val parameterType = boxedType
|
irFactory.buildFun {
|
||||||
val returnType = unboxedType
|
startOffset = inlinedClass.startOffset
|
||||||
|
endOffset = inlinedClass.endOffset
|
||||||
val startOffset = inlinedClass.startOffset
|
origin = DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION
|
||||||
val endOffset = inlinedClass.endOffset
|
name = Name.special("<${classes.reversed().joinToString(".") { it.name.asString() } }-unbox>")
|
||||||
|
returnType = unboxedType
|
||||||
IrFunctionImpl(
|
}.also { function ->
|
||||||
startOffset, endOffset,
|
|
||||||
DECLARATION_ORIGIN_INLINE_CLASS_SPECIAL_FUNCTION,
|
|
||||||
IrSimpleFunctionSymbolImpl(),
|
|
||||||
Name.special("<${classes.reversed().joinToString(".") { it.name.asString() } }-unbox>"),
|
|
||||||
DescriptorVisibilities.PUBLIC,
|
|
||||||
Modality.FINAL,
|
|
||||||
returnType,
|
|
||||||
isInline = false,
|
|
||||||
isExternal = false,
|
|
||||||
isTailrec = false,
|
|
||||||
isSuspend = false,
|
|
||||||
isExpect = false,
|
|
||||||
isFakeOverride = false,
|
|
||||||
isOperator = false,
|
|
||||||
isInfix = false
|
|
||||||
).also { function ->
|
|
||||||
function.valueParameters = listOf(
|
|
||||||
IrValueParameterImpl(
|
|
||||||
startOffset, endOffset,
|
|
||||||
IrDeclarationOrigin.DEFINED,
|
|
||||||
IrValueParameterSymbolImpl(),
|
|
||||||
Name.identifier("value"),
|
|
||||||
index = 0,
|
|
||||||
varargElementType = null,
|
|
||||||
isCrossinline = false,
|
|
||||||
type = parameterType,
|
|
||||||
isNoinline = false,
|
|
||||||
isHidden = false,
|
|
||||||
isAssignable = false
|
|
||||||
).also {
|
|
||||||
it.parent = function
|
|
||||||
})
|
|
||||||
function.parent = parent
|
function.parent = parent
|
||||||
|
|
||||||
|
function.addValueParameter {
|
||||||
|
startOffset = inlinedClass.startOffset
|
||||||
|
endOffset = inlinedClass.endOffset
|
||||||
|
name = Name.identifier("value")
|
||||||
|
type = boxedType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-32
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
|||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrTypeSystemContext
|
import org.jetbrains.kotlin.ir.types.IrTypeSystemContext
|
||||||
import org.jetbrains.kotlin.ir.types.IrTypeSystemContextImpl
|
import org.jetbrains.kotlin.ir.types.IrTypeSystemContextImpl
|
||||||
|
import org.jetbrains.kotlin.ir.util.SymbolTable
|
||||||
import org.jetbrains.kotlin.konan.library.KonanLibraryLayout
|
import org.jetbrains.kotlin.konan.library.KonanLibraryLayout
|
||||||
import org.jetbrains.kotlin.konan.target.Architecture
|
import org.jetbrains.kotlin.konan.target.Architecture
|
||||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||||
@@ -44,7 +45,6 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
||||||
import kotlin.reflect.KProperty
|
|
||||||
|
|
||||||
internal class NativeMapping : DefaultMapping() {
|
internal class NativeMapping : DefaultMapping() {
|
||||||
data class BridgeKey(val target: IrSimpleFunction, val bridgeDirections: BridgeDirections)
|
data class BridgeKey(val target: IrSimpleFunction, val bridgeDirections: BridgeDirections)
|
||||||
@@ -57,6 +57,9 @@ internal class NativeMapping : DefaultMapping() {
|
|||||||
val outerThisCacheAccessors = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrClass, IrSimpleFunction>()
|
val outerThisCacheAccessors = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrClass, IrSimpleFunction>()
|
||||||
val lateinitPropertyCacheAccessors = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrProperty, IrSimpleFunction>()
|
val lateinitPropertyCacheAccessors = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrProperty, IrSimpleFunction>()
|
||||||
val objectInstanceGetter = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrClass, IrSimpleFunction>()
|
val objectInstanceGetter = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrClass, IrSimpleFunction>()
|
||||||
|
val boxFunctions = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrClass, IrSimpleFunction>()
|
||||||
|
val unboxFunctions = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrClass, IrSimpleFunction>()
|
||||||
|
val loweredInlineClassConstructors = DefaultDelegateFactory.newDeclarationToDeclarationMapping<IrConstructor, IrSimpleFunction>()
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Context(config: KonanConfig) : KonanBackendContext(config), ConfigChecks {
|
internal class Context(config: KonanConfig) : KonanBackendContext(config), ConfigChecks {
|
||||||
@@ -66,6 +69,11 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config), Confi
|
|||||||
|
|
||||||
lateinit var moduleDescriptor: ModuleDescriptor
|
lateinit var moduleDescriptor: ModuleDescriptor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valid from [createSymbolTablePhase] until [destroySymbolTablePhase].
|
||||||
|
*/
|
||||||
|
var symbolTable: SymbolTable? = null
|
||||||
|
|
||||||
lateinit var cAdapterGenerator: CAdapterGenerator
|
lateinit var cAdapterGenerator: CAdapterGenerator
|
||||||
|
|
||||||
lateinit var expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>
|
lateinit var expectDescriptorToSymbol: MutableMap<DeclarationDescriptor, IrSymbol>
|
||||||
@@ -94,37 +102,6 @@ internal class Context(config: KonanConfig) : KonanBackendContext(config), Confi
|
|||||||
val enumsSupport by lazy { EnumsSupport(mapping, irBuiltIns, irFactory) }
|
val enumsSupport by lazy { EnumsSupport(mapping, irBuiltIns, irFactory) }
|
||||||
val cachesAbiSupport by lazy { CachesAbiSupport(mapping, irFactory) }
|
val cachesAbiSupport by lazy { CachesAbiSupport(mapping, irFactory) }
|
||||||
|
|
||||||
open class LazyMember<T>(val initializer: Context.() -> T) {
|
|
||||||
operator fun getValue(thisRef: Context, property: KProperty<*>): T = thisRef.getValue(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
class LazyVarMember<T>(initializer: Context.() -> T) : LazyMember<T>(initializer) {
|
|
||||||
operator fun setValue(thisRef: Context, property: KProperty<*>, newValue: T) = thisRef.setValue(this, newValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun <T> lazyMember(initializer: Context.() -> T) = LazyMember<T>(initializer)
|
|
||||||
|
|
||||||
fun <K, V> lazyMapMember(initializer: Context.(K) -> V): LazyMember<(K) -> V> = lazyMember {
|
|
||||||
val storage = mutableMapOf<K, V>()
|
|
||||||
val result: (K) -> V = {
|
|
||||||
storage.getOrPut(it, { initializer(it) })
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
fun <T> nullValue() = LazyVarMember<T?>({ null })
|
|
||||||
}
|
|
||||||
|
|
||||||
private val lazyValues = mutableMapOf<LazyMember<*>, Any?>()
|
|
||||||
|
|
||||||
fun <T> getValue(member: LazyMember<T>): T =
|
|
||||||
@Suppress("UNCHECKED_CAST") (lazyValues.getOrPut(member, { member.initializer(this) }) as T)
|
|
||||||
|
|
||||||
fun <T> setValue(member: LazyVarMember<T>, newValue: T) {
|
|
||||||
lazyValues[member] = newValue
|
|
||||||
}
|
|
||||||
|
|
||||||
val reflectionTypes: KonanReflectionTypes by lazy(PUBLICATION) {
|
val reflectionTypes: KonanReflectionTypes by lazy(PUBLICATION) {
|
||||||
KonanReflectionTypes(moduleDescriptor)
|
KonanReflectionTypes(moduleDescriptor)
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -76,11 +76,6 @@ internal fun konanUnitPhase(
|
|||||||
op: Context.() -> Unit
|
op: Context.() -> Unit
|
||||||
) = namedOpUnitPhase(name, description, prerequisite, op)
|
) = namedOpUnitPhase(name, description, prerequisite, op)
|
||||||
|
|
||||||
/**
|
|
||||||
* Valid from [createSymbolTablePhase] until [destroySymbolTablePhase].
|
|
||||||
*/
|
|
||||||
private var Context.symbolTable: SymbolTable? by Context.nullValue()
|
|
||||||
|
|
||||||
internal val createSymbolTablePhase = konanUnitPhase(
|
internal val createSymbolTablePhase = konanUnitPhase(
|
||||||
op = {
|
op = {
|
||||||
this.symbolTable = SymbolTable(KonanIdSignaturer(KonanManglerDesc), IrFactoryImpl)
|
this.symbolTable = SymbolTable(KonanIdSignaturer(KonanManglerDesc), IrFactoryImpl)
|
||||||
|
|||||||
+11
-21
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.backend.konan.lower
|
|||||||
import org.jetbrains.kotlin.backend.common.AbstractValueUsageTransformer
|
import org.jetbrains.kotlin.backend.common.AbstractValueUsageTransformer
|
||||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||||
import org.jetbrains.kotlin.backend.common.atMostOne
|
import org.jetbrains.kotlin.backend.common.atMostOne
|
||||||
|
import org.jetbrains.kotlin.backend.common.getOrPut
|
||||||
import org.jetbrains.kotlin.backend.common.lower.*
|
import org.jetbrains.kotlin.backend.common.lower.*
|
||||||
import org.jetbrains.kotlin.backend.konan.*
|
import org.jetbrains.kotlin.backend.konan.*
|
||||||
import org.jetbrains.kotlin.backend.konan.cgen.hasCCallAnnotation
|
import org.jetbrains.kotlin.backend.konan.cgen.hasCCallAnnotation
|
||||||
@@ -16,9 +17,9 @@ import org.jetbrains.kotlin.descriptors.Modality
|
|||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||||
import org.jetbrains.kotlin.ir.IrStatement
|
import org.jetbrains.kotlin.ir.IrStatement
|
||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
|
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrFieldImpl
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFunctionImpl
|
|
||||||
import org.jetbrains.kotlin.ir.declarations.impl.IrPropertyImpl
|
import org.jetbrains.kotlin.ir.declarations.impl.IrPropertyImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
||||||
@@ -26,7 +27,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrConstantPrimitiveImpl
|
|||||||
import org.jetbrains.kotlin.ir.symbols.*
|
import org.jetbrains.kotlin.ir.symbols.*
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
|
import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrPropertySymbolImpl
|
import org.jetbrains.kotlin.ir.symbols.impl.IrPropertySymbolImpl
|
||||||
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
|
|
||||||
import org.jetbrains.kotlin.ir.transformStatement
|
import org.jetbrains.kotlin.ir.transformStatement
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.isNullable
|
import org.jetbrains.kotlin.ir.types.isNullable
|
||||||
@@ -505,7 +505,7 @@ private class InlineClassTransformer(private val context: Context) : IrBuildingT
|
|||||||
irClass.declarations.filterIsInstance<IrProperty>().mapNotNull { it.backingField?.takeUnless { it.isStatic } }.single()
|
irClass.declarations.filterIsInstance<IrProperty>().mapNotNull { it.backingField?.takeUnless { it.isStatic } }.single()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val Context.getLoweredInlineClassConstructor: (IrConstructor) -> IrSimpleFunction by Context.lazyMapMember { irConstructor ->
|
private fun Context.getLoweredInlineClassConstructor(irConstructor: IrConstructor): IrSimpleFunction = mapping.loweredInlineClassConstructors.getOrPut(irConstructor) {
|
||||||
require(irConstructor.constructedClass.isInlined())
|
require(irConstructor.constructedClass.isInlined())
|
||||||
|
|
||||||
val returnType = if (irConstructor.isPrimary) {
|
val returnType = if (irConstructor.isPrimary) {
|
||||||
@@ -518,23 +518,13 @@ private val Context.getLoweredInlineClassConstructor: (IrConstructor) -> IrSimpl
|
|||||||
irConstructor.returnType
|
irConstructor.returnType
|
||||||
}
|
}
|
||||||
|
|
||||||
IrFunctionImpl(
|
irFactory.buildFun {
|
||||||
irConstructor.startOffset, irConstructor.endOffset,
|
startOffset = irConstructor.startOffset
|
||||||
IrDeclarationOrigin.DEFINED,
|
endOffset = irConstructor.endOffset
|
||||||
IrSimpleFunctionSymbolImpl(),
|
name = Name.special("<constructor>")
|
||||||
Name.special("<constructor>"),
|
visibility = irConstructor.visibility
|
||||||
irConstructor.visibility,
|
this.returnType = returnType
|
||||||
Modality.FINAL,
|
}.apply {
|
||||||
isInline = false,
|
|
||||||
isExternal = false,
|
|
||||||
isTailrec = false,
|
|
||||||
isSuspend = false,
|
|
||||||
returnType = returnType,
|
|
||||||
isExpect = false,
|
|
||||||
isFakeOverride = false,
|
|
||||||
isOperator = false,
|
|
||||||
isInfix = false
|
|
||||||
).apply {
|
|
||||||
parent = irConstructor.parent
|
parent = irConstructor.parent
|
||||||
|
|
||||||
// Note: technically speaking, this function doesn't have access to class type parameters (since it is "static").
|
// Note: technically speaking, this function doesn't have access to class type parameters (since it is "static").
|
||||||
@@ -543,6 +533,6 @@ private val Context.getLoweredInlineClassConstructor: (IrConstructor) -> IrSimpl
|
|||||||
// So it is just a trick to make [copyTo] happy:
|
// So it is just a trick to make [copyTo] happy:
|
||||||
val remapTypeMap = irConstructor.constructedClass.typeParameters.associateBy { it }
|
val remapTypeMap = irConstructor.constructedClass.typeParameters.associateBy { it }
|
||||||
|
|
||||||
valueParameters += irConstructor.valueParameters.map { it.copyTo(this, remapTypeMap = remapTypeMap) }
|
valueParameters = irConstructor.valueParameters.map { it.copyTo(this, remapTypeMap = remapTypeMap) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user