| 11 | import unluac.parse.LFunction; |
| 12 | |
| 13 | abstract public class ForBlock extends ContainerBlock { |
| 14 | |
| 15 | protected final int register; |
| 16 | protected final boolean forvarClose; |
| 17 | |
| 18 | protected Target target; |
| 19 | protected Expression start; |
| 20 | protected Expression stop; |
| 21 | protected Expression step; |
| 22 | |
| 23 | public ForBlock(LFunction function, int begin, int end, int register, CloseType closeType, int closeLine, boolean forvarClose) { |
| 24 | super(function, begin, end, closeType, closeLine, -1); |
| 25 | this.register = register; |
| 26 | this.forvarClose = forvarClose; |
| 27 | } |
| 28 | |
| 29 | abstract public void handleVariableDeclarations(Registers r); |
| 30 | |
| 31 | @Override |
| 32 | public void walk(Walker w) { |
| 33 | w.visitStatement(this); |
| 34 | start.walk(w); |
| 35 | stop.walk(w); |
| 36 | step.walk(w); |
| 37 | for(Statement statement : statements) { |
| 38 | statement.walk(w); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public int scopeEnd() { |
| 44 | int scopeEnd = end - 2; |
| 45 | if(forvarClose) scopeEnd--; |
| 46 | if(usingClose && (closeType == CloseType.CLOSE || closeType == CloseType.JMP)) scopeEnd--; |
| 47 | return scopeEnd; |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public boolean breakable() { |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public boolean isUnprotected() { |
| 57 | return false; |
| 58 | } |
| 59 | |
| 60 | @Override |
| 61 | public int getLoopback() { |
| 62 | throw new IllegalStateException(); |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public void print(Decompiler d, Output out) { |
| 67 | out.print("for "); |
| 68 | target.print(d, out, false); |
| 69 | out.print(" = "); |
| 70 | start.print(d, out); |
nothing calls this directly
no outgoing calls
no test coverage detected