From 852ae7d8d1fa79364eaa08fb250eb0365803f87b Mon Sep 17 00:00:00 2001 From: Lucaskyy Date: Sun, 26 Jun 2022 16:20:45 +0200 Subject: [PATCH] refactor: move BytecodeData#proxy into class --- .../revanced/patcher/data/impl/BytecodeData.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/kotlin/app/revanced/patcher/data/impl/BytecodeData.kt b/src/main/kotlin/app/revanced/patcher/data/impl/BytecodeData.kt index 467951c..d1825a1 100644 --- a/src/main/kotlin/app/revanced/patcher/data/impl/BytecodeData.kt +++ b/src/main/kotlin/app/revanced/patcher/data/impl/BytecodeData.kt @@ -28,6 +28,15 @@ class BytecodeData( classes.proxies.firstOrNull { predicate(it.immutableClass) } ?: // else resolve the class to a proxy and return it, if the predicate is matching a class classes.find(predicate)?.let { proxy(it) } + + fun proxy(classDef: ClassDef): app.revanced.patcher.util.proxy.ClassProxy { + var proxy = this.classes.proxies.find { it.immutableClass.type == classDef.type } + if (proxy == null) { + proxy = app.revanced.patcher.util.proxy.ClassProxy(classDef) + this.classes.add(proxy) + } + return proxy + } } internal class MethodNotFoundException(s: String) : Exception(s) @@ -57,13 +66,4 @@ internal inline fun Iterable.findIndexed(predicate: (T) -> Boolean): Pair } } return null -} - -fun BytecodeData.proxy(classDef: ClassDef): app.revanced.patcher.util.proxy.ClassProxy { - var proxy = this.classes.proxies.find { it.immutableClass.type == classDef.type } - if (proxy == null) { - proxy = app.revanced.patcher.util.proxy.ClassProxy(classDef) - this.classes.add(proxy) - } - return proxy } \ No newline at end of file