Skip to content

Commit

Permalink
Small clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
NebelNidas committed Dec 8, 2023
1 parent 86c394f commit c8a2e95
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/main/java/net/fabricmc/mappingio/format/srg/JamFileWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,26 +111,27 @@ public void visitDstName(MappedElementKind targetKind, int namespace, String nam

@Override
public boolean visitElementContent(MappedElementKind targetKind) throws IOException {
boolean field = false;
boolean arg = false;
boolean isClass = targetKind == MappedElementKind.CLASS;
boolean isMethod = false;
boolean isArg = false;

if (targetKind == MappedElementKind.CLASS) {
if (isClass) {
if (!classOnlyPass || classDstName == null) {
return true;
}

write("CL ");
} else if (targetKind == MappedElementKind.METHOD
|| (field = targetKind == MappedElementKind.FIELD)
|| (arg = targetKind == MappedElementKind.METHOD_ARG)) {
} else if (targetKind == MappedElementKind.FIELD
|| (isMethod = targetKind == MappedElementKind.METHOD)
|| (isArg = targetKind == MappedElementKind.METHOD_ARG)) {
if (classOnlyPass || memberSrcDesc == null || memberDstName == null) {
return !field && !arg;
return isMethod;
}

if (field) {
write("FD ");
} else if (!arg) {
if (isMethod) {
write("MD ");
} else if (!isArg) {
write("FD ");
} else {
if (argSrcPosition == -1 || argDstName == null) return false;
write("MP ");
Expand All @@ -142,7 +143,7 @@ public boolean visitElementContent(MappedElementKind targetKind) throws IOExcept
write(classSrcName);
writeSpace();

if (targetKind == MappedElementKind.CLASS) {
if (isClass) {
write(classDstName);
} else {
write(memberSrcName);
Expand All @@ -151,7 +152,7 @@ public boolean visitElementContent(MappedElementKind targetKind) throws IOExcept
write(memberSrcDesc);
writeSpace();

if (!arg) {
if (!isArg) {
write(memberDstName);
} else {
write(Integer.toString(argSrcPosition));
Expand All @@ -162,7 +163,7 @@ public boolean visitElementContent(MappedElementKind targetKind) throws IOExcept

writeLn();

return targetKind == MappedElementKind.CLASS || targetKind == MappedElementKind.METHOD;
return isClass || isMethod;
}

@Override
Expand Down

0 comments on commit c8a2e95

Please sign in to comment.