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

Class LabelAST

src/main/java/me/coley/recaf/parse/bytecode/ast/LabelAST.java:11–44  ·  view source on GitHub ↗

Label AST. @author Matt

Source from the content-addressed store, hash-verified

9 * @author Matt
10 */
11public class LabelAST extends AST implements Compilable {
12 private final NameAST name;
13
14 /**
15 * @param line
16 * Line number this node is written on.
17 * @param start
18 * Offset from line start this node starts at.
19 * @param name
20 * Label name.
21 */
22 public LabelAST(int line, int start, NameAST name) {
23 super(line, start);
24 this.name = name;
25 }
26
27 /**
28 * @return Name AST.
29 */
30 public NameAST getName() {
31 return name;
32 }
33
34
35 @Override
36 public String print() {
37 return name.print() + ":";
38 }
39
40 @Override
41 public void compile(MethodCompilation compilation) throws AssemblerException {
42 compilation.addInstruction(compilation.getLabel(getName().getName()), this);
43 }
44}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected