[IR] Partial linkage: unify UnlinkedDeclarationsSupport for JS and Native backends
This commit is contained in:
committed by
Space Team
parent
7b9aed25da
commit
a0fdf08b56
+2
-1
@@ -7,6 +7,7 @@ import org.jetbrains.kotlin.backend.common.serialization.DescriptorByIdSignature
|
||||
import org.jetbrains.kotlin.backend.common.serialization.linkerissues.checkNoUnboundSymbols
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.ManglerChecker
|
||||
import org.jetbrains.kotlin.backend.common.serialization.mangle.descriptor.Ir2DescriptorManglerAdapter
|
||||
import org.jetbrains.kotlin.backend.common.serialization.unlinked.UnlinkedDeclarationsSupportImpl
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.isForwardDeclarationModule
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.isFromInteropLibrary
|
||||
import org.jetbrains.kotlin.backend.konan.ir.KonanSymbols
|
||||
@@ -122,7 +123,7 @@ internal fun Context.psiToIr(
|
||||
config.resolve.includedLibraries.map { it.uniqueName }
|
||||
).associateWith { friendModules }
|
||||
|
||||
val unlinkedDeclarationsSupport = KonanUnlinkedDeclarationsSupport(generatorContext.irBuiltIns, allowUnboundSymbols)
|
||||
val unlinkedDeclarationsSupport = UnlinkedDeclarationsSupportImpl(generatorContext.irBuiltIns, allowUnboundSymbols)
|
||||
|
||||
KonanIrLinker(
|
||||
currentModule = moduleDescriptor,
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.konan.serialization
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.serialization.unlinked.BasicUnlinkedDeclarationsSupport
|
||||
import org.jetbrains.kotlin.backend.common.serialization.unlinked.UnlinkedDeclarationsSupport.UnlinkedMarkerTypeHandler
|
||||
import org.jetbrains.kotlin.ir.IrBuiltIns
|
||||
import org.jetbrains.kotlin.ir.types.IrErrorType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
|
||||
|
||||
/**
|
||||
* Kotlin/Native backend does not support [IrErrorType].
|
||||
* So, let's use a special instance of nullable [kotlin.Any] as a marker-type instead.
|
||||
*/
|
||||
class KonanUnlinkedDeclarationsSupport(
|
||||
override val builtIns: IrBuiltIns,
|
||||
override val allowUnboundSymbols: Boolean
|
||||
) : BasicUnlinkedDeclarationsSupport() {
|
||||
override val handler = object : UnlinkedMarkerTypeHandler {
|
||||
override val unlinkedMarkerType = IrSimpleTypeImpl(
|
||||
classifier = builtIns.anyClass,
|
||||
hasQuestionMark = true,
|
||||
arguments = emptyList(),
|
||||
annotations = emptyList()
|
||||
)
|
||||
|
||||
override fun IrType.isUnlinkedMarkerType(): Boolean = this === unlinkedMarkerType
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user