Skip to content

Commit

Permalink
refactor: make method a property
Browse files Browse the repository at this point in the history
  • Loading branch information
Sculas authored and oSumAtrIX committed Jun 5, 2022
1 parent eef448c commit c267b12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app.revanced.patcher.signature

import app.revanced.patcher.proxy.ClassProxy
import app.revanced.patcher.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.signature.resolver.SignatureResolver

/**
Expand All @@ -15,8 +14,8 @@ data class SignatureResolverResult(
val scanData: PatternScanResult,
private val resolvedMethodName: String,
) {
fun method(): MutableMethod {
return definingClassProxy.resolve().methods.first { it.name == resolvedMethodName }
val method get() = definingClassProxy.resolve().methods.first {
it.name == resolvedMethodName
}

@Suppress("Unused") // TODO(Sculas): remove this when we have coverage for this method.
Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/app/revanced/patcher/PatcherTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal class PatcherTest {
// Get the result from the resolver cache
val result = cache.methodMap["main-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."
// Get the start index of our opcode pattern.
// This will be the index of the instruction with the opcode CONST_STRING.
Expand Down

0 comments on commit c267b12

Please sign in to comment.