feat(YouTube - Hide layout components): Add option to hide Yoodles (YouTube Doodles) (#3743)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
5a08620356
commit
0679a47b22
6 changed files with 74 additions and 4 deletions
|
|
@ -224,18 +224,25 @@ fun Method.indexOfFirstInstructionOrThrow(startIndex: Int = 0, predicate: Instru
|
|||
/**
|
||||
* @return The list of indices of the opcode in reverse order.
|
||||
*/
|
||||
fun Method.findOpcodeIndicesReversed(opcode: Opcode): List<Int> {
|
||||
fun Method.findOpcodeIndicesReversed(opcode: Opcode): List<Int> =
|
||||
findOpcodeIndicesReversed { this.opcode == opcode }
|
||||
|
||||
/**
|
||||
* @return The list of indices of the opcode in reverse order.
|
||||
*/
|
||||
fun Method.findOpcodeIndicesReversed(filter: Instruction.() -> Boolean): List<Int> {
|
||||
val indexes = implementation!!.instructions
|
||||
.withIndex()
|
||||
.filter { (_, instruction) -> instruction.opcode == opcode }
|
||||
.filter { (_, instruction) -> filter(instruction) }
|
||||
.map { (index, _) -> index }
|
||||
.reversed()
|
||||
|
||||
if (indexes.isEmpty()) throw PatchException("No ${opcode.name} instructions found in: $this")
|
||||
if (indexes.isEmpty()) throw PatchException("No matching instructions found in: $this")
|
||||
|
||||
return indexes
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the resolved method early.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue