if (first) { first = false; } else { writer.write(","); }
if (ai instanceof FieldInsnNode) {
FieldInsnNode n = ((FieldInsnNode)ai);
writer.write("\n\t\t\t\tfieldRef(" + n.getOpcode() + ", \"" + escape(n.owner) + "\", \"" + escape(n.name) + "\", \"" + escape(n.desc) + "\")");
} else if (ai instanceof IincInsnNode) {
IincInsnNode n = ((IincInsnNode)ai);
writer.write("\n\t\t\t\tincrement(" + n.var + ", " + n.incr + ")");
} else if (ai instanceof InsnNode) {
InsnNode n = ((InsnNode)ai);
writer.write("\n\t\t\t\tinstruction(" + n.getOpcode() + ")");
} else if (ai instanceof IntInsnNode) {
IntInsnNode n = ((IntInsnNode)ai);
writer.write("\n\t\t\t\tinteger(" + n.getOpcode() + ", " + n.operand + ")");
} else if (ai instanceof JumpInsnNode) {
JumpInsnNode n = ((JumpInsnNode)ai);
writer.write("\n\t\t\t\tjump(" + n.getOpcode() + ", " + getLabelIndex(n.label) + ")");
} else if (ai instanceof LabelNode) {
LabelNode n = ((LabelNode)ai);
writer.write("\n\t\t\t\tlabel(" + getLabelIndex(n) + ")");
} else if (ai instanceof LineNumberNode) {
LineNumberNode n = ((LineNumberNode)ai);
writer.write("\n\t\t\t\tlineNumber(" + n.line + ", " + getLabelIndex(n.start) + ")");
} else if (ai instanceof VarInsnNode) {
VarInsnNode n = ((VarInsnNode)ai);
writer.write("\n\t\t\t\tlocalVariable(" + n.getOpcode() + ", " + n.var + ")");
} else if (ai instanceof LdcInsnNode) {
LdcInsnNode n = ((LdcInsnNode)ai);
if (n.cst instanceof String) {
writer.write("\n\t\t\t\tloadConstantString(\"" + escape((String)n.cst) + "\")");
} else if (n.cst instanceof Integer) {
writer.write("\n\t\t\t\tloadConstantInteger(" + n.cst + ")");
} else if (n.cst instanceof Long) {
writer.write("\n\t\t\t\tloadConstantLong(" + n.cst + ")");
} else if (n.cst instanceof Float) {
writer.write("\n\t\t\t\tloadConstantFloat(" + n.cst + ")");
} else if (n.cst instanceof Double) {
writer.write("\n\t\t\t\tloadConstantDouble(" + n.cst + ")");
}
} else if (ai instanceof LookupSwitchInsnNode) {
LookupSwitchInsnNode n = ((LookupSwitchInsnNode)ai);
writer.write("\n\t\t\t\tlookupSwitch(" + getLabelIndex(n.dflt) + ", [");
boolean firstKey = true;
for (Integer k : (List<Integer>)n.keys) {
if (firstKey) { firstKey = false; } else { writer.write(", "); }
writer.write(k);
}
writer.write("], [");
boolean firstCase = true;
for (LabelNode l : (List<LabelNode>)n.labels) {
if (firstCase) { firstCase = false; } else { writer.write(", "); }
writer.write("" + getLabelIndex(l));
}
writer.write("])");
} else if (ai instanceof MethodInsnNode) {
MethodInsnNode n = ((MethodInsnNode)ai);
writer.write("\n\t\t\t\tmethod(" + n.getOpcode() + ", \"" + escape(n.owner) + "\", \"" + escape(n.name) + "\", \"" + escape(n.desc) + "\")");
} else if (ai instanceof MultiANewArrayInsnNode) {
MultiANewArrayInsnNode n = ((MultiANewArrayInsnNode)ai);
writer.write("\n\t\t\t\tmultiANewArray(\"" + escape(n.desc) + "\", " + n.dims + ")");
} else if (ai instanceof TableSwitchInsnNode) {
TableSwitchInsnNode n = ((TableSwitchInsnNode)ai);
writer.write("\n\t\t\t\ttableSwitch(" + n.min + ", " + n.max + ", " + getLabelIndex(n.dflt) + ", [");
boolean firstCase = true;
for (LabelNode l : (List<LabelNode>)n.labels) {
if (firstCase) { firstCase = false; } else { writer.write(", "); }
writer.write("" + getLabelIndex(l));
}
writer.write("])");
} else if (ai instanceof TypeInsnNode) {
TypeInsnNode n = ((TypeInsnNode)ai);
writer.write("\n\t\t\t\t\\type(" + n.getOpcode() + ", \"" + escape(n.desc) + "\")");
} else {
if (!(ai instanceof FrameNode)) {
throw new RuntimeException("Error: Unsupported instruction encountered (" + ai.getClass() + ").");
}
first = true;