mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-02 05:54:26 +02:00
refactor: make method a property
This commit is contained in:
parent
eef448cc39
commit
c267b12a7d
@ -1,7 +1,6 @@
|
|||||||
package app.revanced.patcher.signature
|
package app.revanced.patcher.signature
|
||||||
|
|
||||||
import app.revanced.patcher.proxy.ClassProxy
|
import app.revanced.patcher.proxy.ClassProxy
|
||||||
import app.revanced.patcher.proxy.mutableTypes.MutableMethod
|
|
||||||
import app.revanced.patcher.signature.resolver.SignatureResolver
|
import app.revanced.patcher.signature.resolver.SignatureResolver
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,8 +14,8 @@ data class SignatureResolverResult(
|
|||||||
val scanData: PatternScanResult,
|
val scanData: PatternScanResult,
|
||||||
private val resolvedMethodName: String,
|
private val resolvedMethodName: String,
|
||||||
) {
|
) {
|
||||||
fun method(): MutableMethod {
|
val method get() = definingClassProxy.resolve().methods.first {
|
||||||
return definingClassProxy.resolve().methods.first { it.name == resolvedMethodName }
|
it.name == resolvedMethodName
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("Unused") // TODO(Sculas): remove this when we have coverage for this method.
|
@Suppress("Unused") // TODO(Sculas): remove this when we have coverage for this method.
|
||||||
|
@ -51,7 +51,7 @@ internal class PatcherTest {
|
|||||||
// Get the result from the resolver cache
|
// Get the result from the resolver cache
|
||||||
val result = cache.methodMap["main-method"]
|
val result = cache.methodMap["main-method"]
|
||||||
// Get the implementation for the resolved method
|
// Get the implementation for the resolved method
|
||||||
val implementation = result.method().implementation!!
|
val implementation = result.method.implementation!!
|
||||||
// Let's modify it, so it prints "Hello, ReVanced! Editing bytecode."
|
// Let's modify it, so it prints "Hello, ReVanced! Editing bytecode."
|
||||||
// Get the start index of our opcode pattern.
|
// Get the start index of our opcode pattern.
|
||||||
// This will be the index of the instruction with the opcode CONST_STRING.
|
// This will be the index of the instruction with the opcode CONST_STRING.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user