use mod to be able to access the last index with -1 conveniently

This commit is contained in:
oSumAtrIX
2026-01-29 22:27:25 +01:00
parent dea958c761
commit c599af6c9a

View File

@@ -1186,12 +1186,12 @@ open class Match(
context(_: BytecodePatchContext)
operator fun component3() = immutableClassDef
operator fun get(index: Int) = indices[0][index]
operator fun get(index: Int) = indices.first().let { first -> first[index.mod(first.size)] }
operator fun get(
matcherIndex: Int,
index: Int,
) = indices[matcherIndex][index]
) = indices[matcherIndex.mod(indices[0].size)].let { indices -> indices[index.mod(indices.size)] }
}
context(context: BytecodePatchContext)