mirror of
https://github.com/ReVanced/revanced-patcher.git
synced 2024-11-10 01:02:22 +01:00
refactor: Simplify fingerprint resolution
This commit is contained in:
parent
aa71146b1b
commit
a1fbb7990f
2 changed files with 5 additions and 2 deletions
|
@ -183,7 +183,7 @@ class Patcher(
|
|||
// TODO: Implement this in a more polymorphic way.
|
||||
when (patch) {
|
||||
is BytecodePatch -> {
|
||||
patch.fingerprints.toList().resolveUsingLookupMap(context.bytecodeContext)
|
||||
patch.fingerprints.resolveUsingLookupMap(context.bytecodeContext)
|
||||
patch.execute(context.bytecodeContext)
|
||||
}
|
||||
is ResourcePatch -> {
|
||||
|
|
|
@ -159,9 +159,12 @@ abstract class MethodFingerprint(
|
|||
* - Faster: Specify [accessFlags], [returnType] and [parameters].
|
||||
* - Fastest: Specify [strings], with at least one string being an exact (non-partial) match.
|
||||
*/
|
||||
internal fun List<MethodFingerprint>.resolveUsingLookupMap(context: BytecodeContext) {
|
||||
internal fun Set<MethodFingerprint>.resolveUsingLookupMap(context: BytecodeContext) {
|
||||
if (methods.isEmpty()) throw PatchException("lookup map not initialized")
|
||||
|
||||
forEach { fingerprint ->
|
||||
fingerprint.resolveUsingLookupMap(context)
|
||||
}
|
||||
for (fingerprint in this) {
|
||||
fingerprint.resolveUsingLookupMap(context)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue