mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-19 15:29:17 +00:00
0.6.14 Support covariant types in callback injector handlers with Coerce
updates #192
This commit is contained in:
1 parent
05469e146c
commit
2a64bc35b4
7 files changed
+95
-39
No files matched your search
@@ -519,14 +519,32 @@ public final class Bytecode {
|
||||
* @param end End position
|
||||
*/
|
||||
public static void loadArgs(Type[] args, InsnList insns, int start, int end) {
|
||||
int pos = start;
|
||||
Bytecode.loadArgs(args, insns, start, end, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Injects appropriate LOAD opcodes into the supplied InsnList appropriate
|
||||
* for each entry in the args array starting at start and ending at end
|
||||
*
|
||||
* @param args Argument types
|
||||
* @param insns Instruction List to inject into
|
||||
* @param start Start position
|
||||
* @param end End position
|
||||
* @param casts Type casts array
|
||||
*/
|
||||
public static void loadArgs(Type[] args, InsnList insns, int start, int end, Type[] casts) {
|
||||
int pos = start, index = 0;
|
||||
|
||||
for (Type type : args) {
|
||||
insns.add(new VarInsnNode(type.getOpcode(Opcodes.ILOAD), pos));
|
||||
if (casts != null && index < casts.length && casts[index] != null) {
|
||||
insns.add(new TypeInsnNode(Opcodes.CHECKCAST, casts[index].getInternalName()));
|
||||
}
|
||||
pos += type.getSize();
|
||||
if (end >= start && pos >= end) {
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user