mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 03:22:17 +00:00
Transform class literals in applied mixins, properly fixes #43
This commit is contained in:
1 parent
6ba4b74785
commit
270fd71bd2
1 file changed
+20
@@ -38,6 +38,7 @@ import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.TypeInsnNode;
|
||||
@@ -241,6 +242,8 @@ public class MixinTargetContext implements IReferenceMapperContext {
|
||||
this.transformFieldNode(method, iter, (FieldInsnNode)insn);
|
||||
} else if (insn instanceof TypeInsnNode) {
|
||||
this.transformTypeNode(method, iter, (TypeInsnNode)insn);
|
||||
} else if (insn instanceof LdcInsnNode) {
|
||||
this.transformConstantNode(method, iter, (LdcInsnNode)insn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,6 +332,23 @@ public class MixinTargetContext implements IReferenceMapperContext {
|
||||
this.transformDescriptor(typeInsn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms class literals in the method being processed.
|
||||
*
|
||||
* @param method Method being processed
|
||||
* @param iter Insn interator
|
||||
* @param ldcInsn Insn to transform
|
||||
*/
|
||||
private void transformConstantNode(MethodNode method, Iterator<AbstractInsnNode> iter, LdcInsnNode ldcInsn) {
|
||||
if (ldcInsn.cst instanceof Type) {
|
||||
Type type = (Type)ldcInsn.cst;
|
||||
String desc = this.transformSingleDescriptor(type);
|
||||
if (!type.toString().equals(desc)) {
|
||||
ldcInsn.cst = Type.getType(desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle "imaginary super" invokations, these are invokations in
|
||||
* non-derived mixins for accessing methods known to exist in a supermixin
|
||||
|
||||
Reference in new issue
Block a user