fix(youtube/litho-filter): use correct type for switch case (#1068)

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
Canny 2022-11-18 22:13:09 +03:00 committed by GitHub
parent 8ec2184edb
commit e46fa2c6a7
2 changed files with 17 additions and 25 deletions

View File

@ -65,21 +65,13 @@ class LithoFilterPatch : BytecodePatch(
}
private companion object {
fun Instruction.toDescriptor() = when (val reference = (this as ReferenceInstruction).reference) {
MethodReference::class -> {
val methodReference = reference as MethodReference
"${methodReference.definingClass}->${methodReference.name}(${
methodReference.parameterTypes.joinToString(
fun Instruction.toDescriptor() = when (val reference = (this as? ReferenceInstruction)?.reference) {
is MethodReference -> "${reference.definingClass}->${reference.name}(${
reference.parameterTypes.joinToString(
""
) { it }
})${methodReference.returnType}"
}
FieldReference::class -> {
val fieldReference = reference as FieldReference
"${fieldReference.definingClass}->${fieldReference.name}:${fieldReference.type}"
}
})${reference.returnType}"
is FieldReference -> "${reference.definingClass}->${reference.name}:${reference.type}"
else -> throw PatchResultError("Unsupported reference type")
}
}