[IR] Replace error("Should not be called") with shouldNotBeCalled()
This commit is contained in:
committed by
Space Team
parent
5a86147e9c
commit
918335e12e
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrMetadataSourceOwner
|
||||
import org.jetbrains.kotlin.ir.util.KotlinMangler
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled
|
||||
|
||||
class Ir2FirManglerAdapter(private val delegate: FirMangler) : AbstractKotlinMangler<IrDeclaration>(),
|
||||
KotlinMangler.IrMangler {
|
||||
@@ -26,15 +27,15 @@ class Ir2FirManglerAdapter(private val delegate: FirMangler) : AbstractKotlinMan
|
||||
override fun IrDeclaration.isExported(compatibleMode: Boolean): Boolean = delegate.run { fir().isExported(compatibleMode) }
|
||||
|
||||
override fun IrDeclaration.mangleString(compatibleMode: Boolean): String {
|
||||
error("Should not be called")
|
||||
shouldNotBeCalled()
|
||||
}
|
||||
|
||||
override fun IrDeclaration.signatureString(compatibleMode: Boolean): String = delegate.run { fir().signatureString(compatibleMode) }
|
||||
|
||||
override fun getMangleComputer(mode: MangleMode, compatibleMode: Boolean): KotlinMangleComputer<IrDeclaration> =
|
||||
error("Should not have been reached")
|
||||
shouldNotBeCalled()
|
||||
|
||||
override fun getExportChecker(compatibleMode: Boolean): KotlinExportChecker<IrDeclaration> {
|
||||
error("Should not be called")
|
||||
shouldNotBeCalled()
|
||||
}
|
||||
}
|
||||
|
||||
+5
-7
@@ -12,16 +12,15 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.ir.util.KotlinMangler
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.shouldNotBeCalled
|
||||
|
||||
object DisabledDescriptorMangler : KotlinMangler.DescriptorMangler {
|
||||
override val String.hashMangle: Long
|
||||
get() = error("Should not be called")
|
||||
get() = shouldNotBeCalled()
|
||||
|
||||
override fun DeclarationDescriptor.isExported(compatibleMode: Boolean): Boolean =
|
||||
error("Should not be called")
|
||||
override fun DeclarationDescriptor.isExported(compatibleMode: Boolean): Boolean = shouldNotBeCalled()
|
||||
|
||||
override fun DeclarationDescriptor.signatureString(compatibleMode: Boolean): String =
|
||||
error("Should not be called")
|
||||
override fun DeclarationDescriptor.signatureString(compatibleMode: Boolean): String = shouldNotBeCalled()
|
||||
}
|
||||
|
||||
object DisabledIdSignatureDescriptor : IdSignatureDescriptor(DisabledDescriptorMangler) {
|
||||
@@ -33,6 +32,5 @@ object DisabledIdSignatureDescriptor : IdSignatureDescriptor(DisabledDescriptorM
|
||||
|
||||
override fun composeAnonInitSignature(descriptor: ClassDescriptor): IdSignature? = null
|
||||
|
||||
override fun createSignatureBuilder(type: SpecialDeclarationType): DescriptorBasedSignatureBuilder =
|
||||
error("Should not be called")
|
||||
override fun createSignatureBuilder(type: SpecialDeclarationType): DescriptorBasedSignatureBuilder = shouldNotBeCalled()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user