From b44bf4c2670fad6174d3692a83c7f6351f1c45e3 Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Fri, 8 Apr 2022 22:55:12 +0200 Subject: [PATCH] chore: move replace extension method to Extensions.kt --- .../kotlin/app/revanced/patcher/extensions/Extensions.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt index 81bb559..73d809b 100644 --- a/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt +++ b/src/main/kotlin/app/revanced/patcher/extensions/Extensions.kt @@ -3,6 +3,7 @@ package app.revanced.patcher.extensions import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.builder.BuilderInstruction import org.jf.dexlib2.builder.MutableMethodImplementation +import org.jf.dexlib2.iface.ClassDef infix fun AccessFlags.or(other: AccessFlags) = this.value or other.value @@ -10,4 +11,9 @@ fun MutableMethodImplementation.addInstructions(index: Int, instructions: List.replace(originalIndex: Int, mutatedClass: ClassDef) { + this.remove(this.elementAt(originalIndex)) + this.add(mutatedClass) +}