mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-09 08:34:25 +02:00
refactor: replace asInstructions with toInstruction to follow proper naming scheme
This commit is contained in:
parent
0bfb92a0cb
commit
3cf07f5ce2
@ -53,5 +53,5 @@ class InlineSmaliCompiler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.asInstructions() = InlineSmaliCompiler.compileMethodInstructions(this)
|
fun String.toInstructions() = InlineSmaliCompiler.compileMethodInstructions(this)
|
||||||
fun String.asInstruction() = this.asInstructions().first()
|
fun String.toInstruction() = this.toInstructions().first()
|
||||||
|
@ -13,8 +13,8 @@ import app.revanced.patcher.signature.MethodMetadata
|
|||||||
import app.revanced.patcher.signature.MethodSignature
|
import app.revanced.patcher.signature.MethodSignature
|
||||||
import app.revanced.patcher.signature.MethodSignatureMetadata
|
import app.revanced.patcher.signature.MethodSignatureMetadata
|
||||||
import app.revanced.patcher.signature.PatternScanMethod
|
import app.revanced.patcher.signature.PatternScanMethod
|
||||||
import app.revanced.patcher.smali.asInstruction
|
import app.revanced.patcher.smali.toInstruction
|
||||||
import app.revanced.patcher.smali.asInstructions
|
import app.revanced.patcher.smali.toInstructions
|
||||||
import com.google.common.collect.ImmutableList
|
import com.google.common.collect.ImmutableList
|
||||||
import org.jf.dexlib2.AccessFlags
|
import org.jf.dexlib2.AccessFlags
|
||||||
import org.jf.dexlib2.Format
|
import org.jf.dexlib2.Format
|
||||||
@ -135,7 +135,7 @@ class ExamplePatch : Patch(
|
|||||||
// store the fields initial value into the first virtual register
|
// store the fields initial value into the first virtual register
|
||||||
implementation.replaceInstruction(
|
implementation.replaceInstruction(
|
||||||
0,
|
0,
|
||||||
"sget-object v0, LTestClass;->dummyField:Ljava/io/PrintStream;".asInstruction()
|
"sget-object v0, LTestClass;->dummyField:Ljava/io/PrintStream;".toInstruction()
|
||||||
)
|
)
|
||||||
|
|
||||||
// Now let's create a new call to our method and print the return value!
|
// Now let's create a new call to our method and print the return value!
|
||||||
@ -147,7 +147,7 @@ class ExamplePatch : Patch(
|
|||||||
invoke-static { }, LTestClass;->returnHello()Ljava/lang/String;
|
invoke-static { }, LTestClass;->returnHello()Ljava/lang/String;
|
||||||
move-result-object v1
|
move-result-object v1
|
||||||
invoke-virtual { v0, v1 }, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
invoke-virtual { v0, v1 }, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
|
||||||
""".trimIndent().asInstructions()
|
""".trimIndent().toInstructions()
|
||||||
implementation.addInstructions(startIndex + 2, instructions)
|
implementation.addInstructions(startIndex + 2, instructions)
|
||||||
|
|
||||||
// Finally, tell the patcher that this patch was a success.
|
// Finally, tell the patcher that this patch was a success.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user