MCPcopy
hub / github.com/Col-E/Recaf / IntInsnAST

Class IntInsnAST

src/main/java/me/coley/recaf/parse/bytecode/ast/IntInsnAST.java:14–53  ·  view source on GitHub ↗

Int instruction AST. @author Matt

Source from the content-addressed store, hash-verified

12 * @author Matt
13 */
14public 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}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected