TextBuffer (int indent, BytecodeMappingTracer tracer) { TextBuffer buf = new TextBuffer(); buf.append(ExprProcessor.listToJava(varDefinitions, indent, tracer)); if (isLabeled()) { buf.appendIndent(indent).append("label").append(Integer.toString(id)).append(":").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } switch (loopType) { case DO -> { buf.appendIndent(indent).append("while(true) {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, false, tracer)); buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } case DO_WHILE -> { buf.appendIndent(indent).append("do {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, false, tracer)); buf.appendIndent(indent).append("} while(").append( Objects.requireNonNull(conditionExprent.get(0)).toJava(indent, tracer)).append(");").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } case WHILE -> { buf.appendIndent(indent).append("while(").append( Objects.requireNonNull(conditionExprent.get(0)).toJava(indent, tracer)).append(") {").appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, false, tracer)); buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } case FOR -> { buf.appendIndent(indent).append("for("); Exprent firstInitExprent = initExprent.get(0); if (firstInitExprent != null) { buf.append(firstInitExprent.toJava(indent, tracer)); } Exprent firstIncExprent = Objects.requireNonNull(incExprent.get(0)); buf.append("; ") .append(Objects.requireNonNull(conditionExprent.get(0)).toJava(indent, tracer)).append("; ") .append(firstIncExprent.toJava(indent, tracer)).append(") {") .appendLineSeparator(); tracer.incrementCurrentSourceLine(); buf.append(ExprProcessor.jmpWrapper(first, indent + 1, false, tracer)); buf.appendIndent(indent).append("}").appendLineSeparator(); tracer.incrementCurrentSourceLine(); } } return buf; }