Add index() to LocalSignature for more clear access
This commit is contained in:
committed by
teamcityserver
parent
5a7298808e
commit
2574c00dd9
@@ -194,6 +194,8 @@ sealed class IdSignature {
|
||||
override val isLocal: Boolean
|
||||
get() = true
|
||||
|
||||
fun index(): Int = hashSig?.toInt() ?: error("Expected index in ${render()}")
|
||||
|
||||
override fun topLevelSignature(): IdSignature {
|
||||
error("Illegal access: Local Sig does not have toplevel (${render()}")
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ class DescriptorByIdSignatureFinder(
|
||||
fqn == MangleConstant.TYPE_PARAMETER_MARKER_NAME || fqn == MangleConstant.TYPE_PARAMETER_MARKER_NAME_SETTER
|
||||
|
||||
if (isTypeParameterSig(inner.localFqn)) {
|
||||
val tpIndex = inner.hashSig?.toInt() ?: error("Expected index in $signature")
|
||||
val tpIndex = inner.index()
|
||||
if (container is CallableDescriptor) {
|
||||
return container.typeParameters[tpIndex]
|
||||
}
|
||||
|
||||
+2
-2
@@ -155,8 +155,8 @@ class IrModuleDeserializerWithBuiltIns(
|
||||
val classSignature = idSig.container
|
||||
val classSymbol = resolveFunctionalInterface(classSignature, BinarySymbolData.SymbolKind.CLASS_SYMBOL) as IrClassSymbol
|
||||
val typeParameterSig = composite.inner as IdSignature.LocalSignature
|
||||
val typeParameterIndex = typeParameterSig.hashSig ?: error("Expected index for $idSig")
|
||||
val typeParameter = classSymbol.owner.typeParameters[typeParameterIndex.toInt()]
|
||||
val typeParameterIndex = typeParameterSig.index()
|
||||
val typeParameter = classSymbol.owner.typeParameters[typeParameterIndex]
|
||||
return typeParameter.symbol
|
||||
}
|
||||
val publicSig = idSig.asPublic() ?: error("$idSig has to be public")
|
||||
|
||||
Reference in New Issue
Block a user