mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 15:02:10 +00:00
Change: Add stack checking to old Target#findInitNodeFor overload and un-deprecate it.
The only reason MixinExtras uses this method is to match Redirect's behaviour, so I would like it to be kept in line with that. Additionally, there is nothing wrong with not checking the desc as long as you've definitely found the right `NEW` insn, which the injection point handles itself.
This commit is contained in:
1 parent
afb9f13921
commit
ea733f9603
1 file changed
+1
-17
@@ -638,25 +638,9 @@ public class Target implements Comparable<Target>, Iterable<AbstractInsnNode> {
|
||||
*
|
||||
* @param newNode NEW insn
|
||||
* @return INVOKESPECIAL opcode of ctor, or null if not found
|
||||
*
|
||||
* @deprecated Use {@link #findInitNodeFor(TypeInsnNode, String)} instead:
|
||||
* this method only matches the first matching <tt><init></tt>
|
||||
* after the specified <tt>NEW</tt>, it also does not filter based on
|
||||
* the descriptor passed into <tt>BeforeNew</tt>.
|
||||
*/
|
||||
@Deprecated
|
||||
public MethodInsnNode findInitNodeFor(TypeInsnNode newNode) {
|
||||
int start = this.indexOf(newNode);
|
||||
for (Iterator<AbstractInsnNode> iter = this.insns.iterator(start); iter.hasNext();) {
|
||||
AbstractInsnNode insn = iter.next();
|
||||
if (insn instanceof MethodInsnNode && insn.getOpcode() == Opcodes.INVOKESPECIAL) {
|
||||
MethodInsnNode methodNode = (MethodInsnNode)insn;
|
||||
if (Constants.CTOR.equals(methodNode.name) && methodNode.owner.equals(newNode.desc)) {
|
||||
return methodNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return this.findInitNodeFor(newNode, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user