MCPcopy Create free account
hub / github.com/Hiro420/NikkeTools / AlwaysLoop

Class AlwaysLoop

UnLuac/src/unluac/decompile/block/AlwaysLoop.java:11–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9import unluac.parse.LFunction;
10
11public class AlwaysLoop extends ContainerBlock {
12
13 private final boolean repeat;
14
15 private ConstantExpression condition;
16
17 public AlwaysLoop(LFunction function, int begin, int end, CloseType closeType, int closeLine, boolean repeat) {
18 super(function, begin, end, closeType, closeLine, 0);
19 this.repeat = repeat;
20 condition = null;
21 }
22
23 @Override
24 public int scopeEnd() {
25 return usingClose && closeType == CloseType.CLOSE ? closeLine - 1 : end - 2;
26 }
27
28 @Override
29 public boolean breakable() {
30 return true;
31 }
32
33 @Override
34 public boolean isUnprotected() {
35 return true;
36 }
37
38 @Override
39 public int getUnprotectedTarget() {
40 return begin;
41 }
42
43 @Override
44 public int getUnprotectedLine() {
45 return end - 1;
46 }
47
48 @Override
49 public int getLoopback() {
50 return begin;
51 }
52
53 @Override
54 public void print(Decompiler d, Output out) {
55 if(repeat) {
56 out.println("repeat");
57 } else {
58 out.print("while ");
59 if(condition == null) {
60 out.print("true");
61 } else {
62 condition.print(d, out);
63 }
64 out.println(" do");
65 }
66 out.indent();
67 Statement.printSequence(d, out, statements);
68 out.dedent();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected