mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-28 01:20:46 +00:00
more string builders 1
This commit is contained in:
@@ -282,7 +282,6 @@ import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.decompiler.graph.model.ScriptEndItem;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -859,24 +858,13 @@ public class AVM2Code implements Cloneable {
|
||||
StringBuilder s = new StringBuilder();
|
||||
for (AVM2Instruction instruction : code) {
|
||||
s.append(instruction.toString());
|
||||
s.append("\r\n");
|
||||
s.append(Helper.newLine);
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public GraphTextWriter toString(GraphTextWriter writer, LocalData localData) {
|
||||
int i = 0;
|
||||
for (AVM2Instruction instruction : code) {
|
||||
writer.appendNoHilight(Helper.formatAddress(i));
|
||||
writer.appendNoHilight(" ");
|
||||
instruction.toString(writer, localData).newLine();
|
||||
i++;
|
||||
}
|
||||
return writer;
|
||||
}
|
||||
|
||||
public GraphTextWriter toASMSource(AVM2ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
return toASMSource(constants, trait, info, body, new ArrayList<Integer>(), exportMode, writer);
|
||||
return toASMSource(constants, trait, info, body, new ArrayList<>(), exportMode, writer);
|
||||
}
|
||||
|
||||
public GraphTextWriter toASMSource(AVM2ConstantPool constants, Trait trait, MethodInfo info, MethodBody body, List<Integer> outputMap, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
|
||||
}
|
||||
|
||||
public GraphTextWriter toString(GraphTextWriter writer, LocalData localData) {
|
||||
writer.appendNoHilight(Helper.formatAddress(offset) + " " + Helper.padSpaceRight(Helper.byteArrToString(getBytes()), 30) + definition.instructionName);
|
||||
writer.appendNoHilight(Helper.formatAddress(offset) + " " + String.format("%-30s", Helper.byteArrToString(getBytes())) + definition.instructionName);
|
||||
writer.appendNoHilight(getParams(localData.constantsAvm2, localData.fullyQualifiedNames) + getComment());
|
||||
return writer;
|
||||
}
|
||||
|
||||
@@ -226,17 +226,25 @@ public class MethodInfo {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String optionalStr = "[";
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append("MethodInfo: param_types=");
|
||||
Helper.intArrToStringBuilder(param_types, ret);
|
||||
ret.append(" ret_type=").append(ret_type)
|
||||
.append(" name_index=").append(name_index)
|
||||
.append(" flags=").append(flags)
|
||||
.append(" optional=[");
|
||||
if (optional != null) {
|
||||
for (int i = 0; i < optional.length; i++) {
|
||||
if (i > 0) {
|
||||
optionalStr += ",";
|
||||
ret.append(",");
|
||||
}
|
||||
optionalStr += optional[i].toString();
|
||||
ret.append(optional[i].toString());
|
||||
}
|
||||
}
|
||||
optionalStr += "]";
|
||||
return "MethodInfo: param_types=" + Helper.intArrToString(param_types) + " ret_type=" + ret_type + " name_index=" + name_index + " flags=" + flags + " optional=" + optionalStr + " paramNames=" + Helper.intArrToString(paramNames);
|
||||
ret.append("]");
|
||||
ret.append(" paramNames=");
|
||||
Helper.intArrToStringBuilder(paramNames, ret);
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
public String toString(AVM2ConstantPool constants, List<String> fullyQualifiedNames) {
|
||||
|
||||
@@ -198,16 +198,17 @@ public class Multiname {
|
||||
if (index == 0) {
|
||||
return "null";
|
||||
}
|
||||
String ret = "[";
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append("[");
|
||||
for (int n = 0; n < constants.getNamespaceSet(index).namespaces.length; n++) {
|
||||
if (n > 0) {
|
||||
ret += ",";
|
||||
ret.append(",");
|
||||
}
|
||||
int ns = constants.getNamespaceSet(index).namespaces[n];
|
||||
ret += namespaceToString(constants, ns);
|
||||
ret.append(namespaceToString(constants, ns));
|
||||
}
|
||||
ret += "]";
|
||||
return ret;
|
||||
ret.append("]");
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
private static String multinameToString(AVM2ConstantPool constants, int index, List<String> fullyQualifiedNames) {
|
||||
|
||||
Reference in New Issue
Block a user