feat: add invokedynamic to BytecodeBuilder
This commit is contained in:
parent
9eaafb50fb
commit
bbbd60ce0a
1 changed files with 6 additions and 14 deletions
|
@ -3,22 +3,10 @@ package dev.ashhhleyyy.bad.framework;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Handle;
|
||||||
import org.objectweb.asm.Label;
|
import org.objectweb.asm.Label;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.*;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
import org.objectweb.asm.tree.FieldInsnNode;
|
|
||||||
import org.objectweb.asm.tree.IincInsnNode;
|
|
||||||
import org.objectweb.asm.tree.InsnNode;
|
|
||||||
import org.objectweb.asm.tree.IntInsnNode;
|
|
||||||
import org.objectweb.asm.tree.JumpInsnNode;
|
|
||||||
import org.objectweb.asm.tree.LabelNode;
|
|
||||||
import org.objectweb.asm.tree.LdcInsnNode;
|
|
||||||
import org.objectweb.asm.tree.LocalVariableNode;
|
|
||||||
import org.objectweb.asm.tree.MethodInsnNode;
|
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
|
||||||
import org.objectweb.asm.tree.TypeInsnNode;
|
|
||||||
import org.objectweb.asm.tree.VarInsnNode;
|
|
||||||
|
|
||||||
public final class BytecodeBuilder {
|
public final class BytecodeBuilder {
|
||||||
private final ClassNode classNode;
|
private final ClassNode classNode;
|
||||||
|
@ -163,6 +151,10 @@ public final class BytecodeBuilder {
|
||||||
this.add(new MethodInsnNode(Opcodes.INVOKESTATIC, owner, name, desc));
|
this.add(new MethodInsnNode(Opcodes.INVOKESTATIC, owner, name, desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void invokedynamic(String name, String descriptor, Handle bsm, Object... bsmArgs) {
|
||||||
|
this.add(new InvokeDynamicInsnNode(name, descriptor, bsm, bsmArgs));
|
||||||
|
}
|
||||||
|
|
||||||
private LabelNode getCurrentLabel() {
|
private LabelNode getCurrentLabel() {
|
||||||
if (this.currentLabel != null) {
|
if (this.currentLabel != null) {
|
||||||
return this.currentLabel;
|
return this.currentLabel;
|
||||||
|
|
Loading…
Reference in a new issue