Line number instruction AST. @author Matt
| 10 | * @author Matt |
| 11 | */ |
| 12 | public class LineInsnAST extends InsnAST { |
| 13 | private final NameAST label; |
| 14 | private final NumberAST lineNumber; |
| 15 | |
| 16 | /** |
| 17 | * @param line |
| 18 | * Line number this node is written on. |
| 19 | * @param start |
| 20 | * Offset from line start this node starts at. |
| 21 | * @param opcode |
| 22 | * Opcode AST. |
| 23 | * @param label |
| 24 | * Label name AST. |
| 25 | * @param lineNumber |
| 26 | * Line number AST. |
| 27 | */ |
| 28 | public LineInsnAST(int line, int start, OpcodeAST opcode, NameAST label, NumberAST lineNumber) { |
| 29 | super(line, start, opcode); |
| 30 | this.label = label; |
| 31 | this.lineNumber = lineNumber; |
| 32 | addChild(label); |
| 33 | addChild(lineNumber); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * @return Label name AST. |
| 38 | */ |
| 39 | public NameAST getLabel() { |
| 40 | return label; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @return Line number AST. |
| 45 | */ |
| 46 | public NumberAST getLineNumber() { |
| 47 | return lineNumber; |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public String print() { |
| 52 | return getOpcode().print() + " " + label.print() + " " + lineNumber.print(); |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public void compile(MethodCompilation compilation) throws AssemblerException { |
| 57 | compilation.addInstruction(new LineNumberNode(getLineNumber().getIntValue(), |
| 58 | compilation.getLabel(getLabel().getName())), this); |
| 59 | } |
| 60 | } |
nothing calls this directly
no outgoing calls
no test coverage detected