Skip to content

Commit

Permalink
fix #9
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed May 12, 2019
1 parent 838bdd1 commit 0bbe4a6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/net/fabricmc/stitch/commands/CommandMergeTiny.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public TinyFile(File f) throws IOException {
prefix.append(parts[i]);
}

TinyEntryType type = TinyEntryType.byName(parts[0]);
String[] path = parts[1].split("\\$");
TinyEntry parent = root;
TinyEntryType type = TinyEntryType.byName(parts[0]);

for (int i = 0; i < (type == TinyEntryType.CLASS ? path.length - 1 : path.length); i++) {
TinyEntry nextParent = parent.getChild(indexList[0], path[i]);
Expand All @@ -161,8 +161,13 @@ public TinyFile(File f) throws IOException {
String[] names = new String[typeCount];
for (int i = 0; i < typeCount; i++) {
names[i] = parts[parts.length - typeCount + i];
String[] splitly = names[i].split("\\$");
entry.names.put(indexList[i], splitly[splitly.length - 1]);
if (type == TinyEntryType.CLASS) {
// add classes by their final inner class name
String[] splitly = names[i].split("\\$");
entry.names.put(indexList[i], splitly[splitly.length - 1]);
} else {
entry.names.put(indexList[i], names[i]);
}
}

switch (type) {
Expand Down Expand Up @@ -270,6 +275,8 @@ private String getMatch(TinyEntry a, TinyEntry b, String index, String realIndex
String matchA = a != null ? a.names.get(index) : null;
String matchB = b != null ? b.names.get(index) : null;

assert a == null || b == null || a.type == b.type;

matchA = fixMatch(a, b, matchA, realIndex);
matchB = fixMatch(b, a, matchB, realIndex);

Expand Down

0 comments on commit 0bbe4a6

Please sign in to comment.