Skip to content

Commit 84a37d0

Browse files
committed
Use correct index for parameter names
1 parent 1fcf7c7 commit 84a37d0

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/main/kotlin/platform/mixin/util/LocalInfo.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@ class LocalInfo(
5353
): Array<LocalVariables.LocalVariable?>? {
5454
return if (argsOnly) {
5555
val args = mutableListOf<LocalVariables.LocalVariable?>()
56-
var index = 0
5756
if (!methodNode.hasAccess(Opcodes.ACC_STATIC)) {
5857
val thisDesc = Type.getObjectType(targetClass.name).descriptor
5958
args.add(LocalVariables.LocalVariable("this", thisDesc, null, null, null, 0))
60-
index++
6159
}
6260
for (argType in Type.getArgumentTypes(methodNode.desc)) {
6361
val hasNamedArguments = module.fabricMixinCompatibility?.let { it >= 17000 } == true
64-
val localName = methodNode.localVariables?.find { it.index == index }?.name
62+
val localName = methodNode.localVariables?.find { it.index == args.size }?.name
6563
val name = if (localName != null && hasNamedArguments) {
6664
localName
6765
} else {
@@ -73,7 +71,6 @@ class LocalInfo(
7371
if (argType.size == 2) {
7472
args.add(null)
7573
}
76-
index++
7774
}
7875
args.toTypedArray()
7976
} else {

src/main/kotlin/platform/mixin/util/LocalVariables.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,17 +441,15 @@ object LocalVariables {
441441
val frames = method.instructions.iterator().asSequence().filterIsInstance<FrameNode>().toList()
442442
val frame = arrayOfNulls<LocalVariable>(method.maxLocals)
443443
var local = 0
444-
var staticOffset = 0
445444

446445
// Initialise implicit "this" reference in non-static methods
447446
if (!method.hasAccess(Opcodes.ACC_STATIC)) {
448447
frame[local++] = LocalVariable("this", Type.getObjectType(classNode.name).toString(), null, null, null, 0)
449-
staticOffset = 1
450448
}
451449

452450
// Initialise method arguments
453451
for ((index, argType) in Type.getArgumentTypes(method.desc).withIndex()) {
454-
val localName = method.localVariables?.find { it.index == index + staticOffset }?.name
452+
val localName = method.localVariables?.find { it.index == local }?.name
455453
val name = if (localName == null || !settings.namedParameters) {
456454
"arg$index"
457455
} else {

0 commit comments

Comments
 (0)