Fixed a bug with switch statements being in wrong order, added sysout

This commit is contained in:
SuspiciousActivity committed 2018-05-10 15:07:51 +02:00
1 parent 1aa5c65163
commit 7b95716a5c
2 files changed
+11 -4

No files matched your search

+9 -4
View File
@@ -3,9 +3,9 @@ package me.ByteEdit.main;
import java.awt.Color;
import java.io.StringReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -327,7 +327,8 @@ public class Assembler {
_handler = new LabelNode(entry.getKey());
}
}
node.tryCatchBlocks.add(new TryCatchBlockNode(_start, _end, _handler, sp[0].equals("null") ? null : sp[0]));
node.tryCatchBlocks.add(
new TryCatchBlockNode(_start, _end, _handler, sp[0].equals("null") ? null : sp[0]));
}
clazz.methods.add(node);
// signature = null;
@@ -1180,13 +1181,14 @@ public class Assembler {
case "tableswitch": {
String str = s.substring(14, s.length() - 2).replace("\t", "");
String split2[] = str.split("\n");
HashMap<Integer, LabelNode> labelMap = new HashMap<>();
LinkedHashMap<Integer, LabelNode> labelMap = new LinkedHashMap<>();
for (int i = 4; i < split2.length - 1; i++) {
labelMap.put(Integer.parseInt(split2[i]), null);
}
LabelNode dflt = null;
if (!split2[2].substring(9).equals("null")) {
int dfltLabelNr = Integer.parseInt(split2[2].substring(9));
for (Entry<Label, Integer> entry : labels.entrySet()) {
if (entry.getValue() == dfltLabelNr) {
@@ -1201,6 +1203,9 @@ public class Assembler {
labels.put(l, dfltLabelNr);
dflt = new LabelNode(l);
}
} else {
dflt = new LabelNode(new Label());
}
LabelNode[] arr = new LabelNode[labelMap.size()];
@@ -1225,7 +1230,7 @@ public class Assembler {
String str = s.substring(15, s.length() - 2).replace("\t", "");
String split2[] = str.split("\n");
ArrayList<Integer> keys = new ArrayList<>();
HashMap<Integer, LabelNode> labelMap = new HashMap<>();
LinkedHashMap<Integer, LabelNode> labelMap = new LinkedHashMap<>();
int stage = 0;
for (int i = 2; i < split2.length; i++) {
+2
View File
@@ -124,6 +124,8 @@ public class Main extends JFrame {
provider.addCompletion(new ShorthandCompletion(provider, "invif", "invokeinterface desc owner/name"));
provider.addCompletion(new ShorthandCompletion(provider, "invst", "invokestatic desc owner/name"));
provider.addCompletion(new ShorthandCompletion(provider, "invsp", "invokespecial desc owner/name"));
provider.addCompletion(new ShorthandCompletion(provider, "sysout",
"getstatic Ljava/io/PrintStream; java/lang/System/out\n\t\tldc \"text\"\n\t\tinvokevirtual (Ljava/lang/String;)V java/io/PrintStream/println"));
return provider;