summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/tools/StackTools.java
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-01 18:05:02 +0100
committer zaaarf <zaaarf@proton.me>2023-03-01 18:05:02 +0100
commitbc649ed0f10a15585e6379551da0b169de1e0c64 (patch)
treef45aac119e946d99b298b729b1db37595b2d7d72 /src/main/java/ftbsc/lll/tools/StackTools.java
parente8b85872f9fb6d8e5719c6224e36d412c35aba7d (diff)
feat: implemented field and method proxies
Diffstat (limited to 'src/main/java/ftbsc/lll/tools/StackTools.java')
-rw-r--r--src/main/java/ftbsc/lll/tools/StackTools.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/ftbsc/lll/tools/StackTools.java b/src/main/java/ftbsc/lll/tools/StackTools.java
index 8cb4504..dbf1858 100644
--- a/src/main/java/ftbsc/lll/tools/StackTools.java
+++ b/src/main/java/ftbsc/lll/tools/StackTools.java
@@ -1,5 +1,6 @@
package ftbsc.lll.tools;
+import ftbsc.lll.proxies.MethodProxy;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.*;
@@ -62,7 +63,7 @@ public class StackTools implements Opcodes {
}
/**
- * Creates a new local variable, lasting in scope between two given LabelNodes.
+ * Creates a new local variable, lasting in scope between two given {@link LabelNode}s.
* @param method the method for which to declare the local variable
* @param name the variable's name
* @param desc the type descriptor for the new variable
@@ -83,4 +84,19 @@ public class StackTools implements Opcodes {
method.localVariables.add(variable);
return targetIndex;
}
+
+ /**
+ * Calls the given {@link MethodProxy} with the given opcode.
+ * @param m a {@link MethodProxy} representing the method to call.
+ * @return a {@link MethodInsnNode} representing the build node.
+ * @since 0.3.0
+ */
+ public static MethodInsnNode call(MethodProxy m, int opcode) {
+ return new MethodInsnNode(
+ opcode,
+ m.getParent().replace('.', '/'),
+ m.getSrgName(),
+ m.getDescriptor()
+ );
+ }
}