mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-17 18:31:58 +00:00
poptreeitem fix
This commit is contained in:
@@ -70,7 +70,9 @@ public class ForEachInTreeItem extends LoopItem implements Block {
|
||||
ret += "loop" + loop.id + ":\r\n";
|
||||
ret += hilight("for each (") + expression.toString(localData) + ")\r\n{\r\n";
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += hilight("}") + "\r\n";
|
||||
ret += ":loop" + loop.id;
|
||||
|
||||
@@ -70,7 +70,9 @@ public class ForInTreeItem extends LoopItem implements Block {
|
||||
ret += "loop" + loop.id + ":\r\n";
|
||||
ret += hilight("for (") + expression.toString(localData) + hilight(")") + "\r\n{\r\n";
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += hilight("}") + "\r\n";
|
||||
ret += ":loop" + loop.id;
|
||||
|
||||
@@ -56,21 +56,27 @@ public class TryTreeItem extends TreeItem implements Block {
|
||||
String ret = "";
|
||||
ret += "try\r\n{\r\n";
|
||||
for (GraphTargetItem ti : tryCommands) {
|
||||
ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += "}";
|
||||
for (int e = 0; e < catchExceptions.size(); e++) {
|
||||
ret += "\r\ncatch(" + catchExceptions.get(e).getVarName(constants, fullyQualifiedNames) + ":" + catchExceptions.get(e).getTypeName(constants, fullyQualifiedNames) + ")\r\n{\r\n";
|
||||
List<GraphTargetItem> commands = catchCommands.get(e);
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += "}";
|
||||
}
|
||||
if (finallyCommands.size() > 0) {
|
||||
ret += "\r\nfinally\r\n{\r\n";
|
||||
for (GraphTargetItem ti : finallyCommands) {
|
||||
ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(Helper.toList(constants, localRegNames, fullyQualifiedNames)) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += "}";
|
||||
}
|
||||
|
||||
@@ -37,4 +37,9 @@ public class PopTreeItem extends TreeItem {
|
||||
public boolean needsSemicolon() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,21 +55,27 @@ public class TryTreeItem extends TreeItem implements Block {
|
||||
List localData = new ArrayList();
|
||||
localData.add(constants);
|
||||
for (GraphTargetItem ti : tryCommands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += "}";
|
||||
for (int e = 0; e < catchExceptions.size(); e++) {
|
||||
ret += "\r\ncatch(" + catchExceptions.get(e).toStringNoQuotes(localData) + ")\r\n{\r\n";
|
||||
List<GraphTargetItem> commands = catchCommands.get(e);
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += "}";
|
||||
}
|
||||
if (finallyCommands.size() > 0) {
|
||||
ret += "\r\nfinally\r\n{\r\n";
|
||||
for (GraphTargetItem ti : finallyCommands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += "}";
|
||||
}
|
||||
|
||||
@@ -48,7 +48,9 @@ public class DoWhileItem extends LoopItem implements Block {
|
||||
ret += "loop" + loop.id + ":\r\n";
|
||||
ret += hilight("do\r\n{") + "\r\n";
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += hilight("}\r\nwhile(") + expression.toString(localData) + hilight(");") + "\r\n";
|
||||
ret += ":loop" + loop.id;
|
||||
|
||||
@@ -72,7 +72,9 @@ public class ForTreeItem extends LoopItem implements Block {
|
||||
}
|
||||
ret += hilight(")") + "\r\n{\r\n";
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += hilight("}") + "\r\n";
|
||||
ret += ":loop" + loop.id;
|
||||
|
||||
@@ -1423,8 +1423,10 @@ public class Graph {
|
||||
localDataList.add(o);
|
||||
}
|
||||
for (GraphTargetItem ti : tree) {
|
||||
ret.append(ti.toStringSemicoloned(localDataList));
|
||||
ret.append("\r\n");
|
||||
if (!ti.isEmpty()) {
|
||||
ret.append(ti.toStringSemicoloned(localDataList));
|
||||
ret.append("\r\n");
|
||||
}
|
||||
}
|
||||
String parts[] = ret.toString().split("\r\n");
|
||||
ret = new StringBuilder();
|
||||
|
||||
@@ -137,4 +137,8 @@ public abstract class GraphTargetItem {
|
||||
}
|
||||
return toString(localData2) + (needsNewLine() ? "\r\n" : "");
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +50,17 @@ public class IfItem extends GraphTargetItem implements Block {
|
||||
String ret;
|
||||
ret = hilight("if(") + expression.toString(localData) + hilight(")") + "\r\n{\r\n";
|
||||
for (GraphTargetItem ti : onTrue) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += hilight("}");
|
||||
if (onFalse.size() > 0) {
|
||||
ret += "\r\n" + hilight("else") + "\r\n" + hilight("{") + "\r\n";
|
||||
for (GraphTargetItem ti : onFalse) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += hilight("}");
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ public class SwitchItem extends LoopItem implements Block {
|
||||
}
|
||||
ret += Graph.INDENTOPEN + "\r\n";
|
||||
for (int j = 0; j < caseCommands.get(i).size(); j++) {
|
||||
ret += caseCommands.get(i).get(j).toStringSemicoloned(localData) + "\r\n";
|
||||
if (!caseCommands.get(i).get(j).isEmpty()) {
|
||||
ret += caseCommands.get(i).get(j).toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += Graph.INDENTCLOSE + "\r\n";
|
||||
}
|
||||
@@ -66,7 +68,9 @@ public class SwitchItem extends LoopItem implements Block {
|
||||
ret += hilight("default") + ":\r\n";
|
||||
ret += Graph.INDENTOPEN + "\r\n";
|
||||
for (int j = 0; j < defaultCommands.size(); j++) {
|
||||
ret += defaultCommands.get(j).toStringSemicoloned(localData) + "\r\n";
|
||||
if (!defaultCommands.get(j).isEmpty()) {
|
||||
ret += defaultCommands.get(j).toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += Graph.INDENTCLOSE + "\r\n";
|
||||
}
|
||||
|
||||
@@ -43,7 +43,9 @@ public class WhileItem extends LoopItem implements Block {
|
||||
ret += "loop" + loop.id + ":\r\n";
|
||||
ret += hilight("while(") + (expression == null ? "null" : expression.toString(localData)) + hilight(")") + "\r\n{\r\n";
|
||||
for (GraphTargetItem ti : commands) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
if (!ti.isEmpty()) {
|
||||
ret += ti.toStringSemicoloned(localData) + "\r\n";
|
||||
}
|
||||
}
|
||||
ret += hilight("}") + "\r\n";
|
||||
ret += ":loop" + loop.id;
|
||||
|
||||
Reference in New Issue
Block a user