diff --git a/src/main/kotlin/app/revanced/patcher/Matching.kt b/src/main/kotlin/app/revanced/patcher/Matching.kt index 6b862ae..5c94cbf 100644 --- a/src/main/kotlin/app/revanced/patcher/Matching.kt +++ b/src/main/kotlin/app/revanced/patcher/Matching.kt @@ -225,12 +225,16 @@ fun Iterable.matchIndexed(build: IndexedMatcher.() -> Unit) = indexedMatcher(build)(this) context(_: MatchContext) -operator fun IndexedMatcher.invoke(iterable: Iterable, key: String, builder: IndexedMatcher.() -> Unit) = +fun Iterable.matchIndexed(key: Any, build: IndexedMatcher.() -> Unit) = + indexedMatcher()(key, this, build) + +context(_: MatchContext) +operator fun IndexedMatcher.invoke(key: Any, iterable: Iterable, builder: IndexedMatcher.() -> Unit) = remember(key) { apply(builder) }(iterable) context(_: MatchContext) -fun Iterable.matchIndexed(key: String, build: IndexedMatcher.() -> Unit) = - indexedMatcher()(this, key, build) +operator fun IndexedMatcher.invoke(iterable: Iterable, builder: IndexedMatcher.() -> Unit) = + invoke(hashCode(), iterable, builder) abstract class Matcher : MutableList by mutableListOf() { var matchIndex = -1