Int instruction AST. @author Matt
| 12 | * @author Matt |
| 13 | */ |
| 14 | public class IntInsnAST extends InsnAST { |
| 15 | private final NumberAST value; |
| 16 | |
| 17 | /** |
| 18 | * @param line |
| 19 | * Line number this node is written on. |
| 20 | * @param start |
| 21 | * Offset from line start this node starts at. |
| 22 | * @param opcode |
| 23 | * Opcode AST. |
| 24 | * @param value |
| 25 | * Int value. |
| 26 | */ |
| 27 | public IntInsnAST(int line, int start, OpcodeAST opcode, NumberAST value) { |
| 28 | super(line, start, opcode); |
| 29 | this.value = value; |
| 30 | addChild(value); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * @return value AST. |
| 35 | */ |
| 36 | public NumberAST getValue() { |
| 37 | return value; |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | public String print() { |
| 42 | if (getOpcode().getOpcode() == Opcodes.NEWARRAY) { |
| 43 | return getOpcode().print() + " " + TypeUtil.newArrayArgToType(value.getIntValue()).getDescriptor(); |
| 44 | } else { |
| 45 | return getOpcode().print() + " " + value.print(); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public void compile(MethodCompilation compilation) throws AssemblerException { |
| 51 | compilation.addInstruction(new IntInsnNode(getOpcode().getOpcode(), getValue().getIntValue()), this); |
| 52 | } |
| 53 | } |
nothing calls this directly
no outgoing calls
no test coverage detected