Skip to content

Commit

Permalink
Complete parameter support
Browse files Browse the repository at this point in the history
  • Loading branch information
NebelNidas committed Sep 20, 2023
1 parent f51f57b commit 10aeeb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static StandardProperty getById(String id) {
public static final StandardProperty IS_STATIC;
public static final StandardProperty START_LINE_NUMBER;
public static final StandardProperty END_LINE_NUMBER;
public static final StandardProperty PARAM_DEST_POS;
private static final Set<StandardProperty> values = new HashSet<>();
private static final Map<String, StandardProperty> valuesByName = new HashMap<>();
private static final Map<String, StandardProperty> valuesById = new HashMap<>();
Expand Down Expand Up @@ -132,6 +133,12 @@ public static StandardProperty getById(String id) {
put(new SimpleEntry<>(MappingFormat.PROGUARD_FILE, MappedElementKind.FIELD), null);
put(new SimpleEntry<>(MappingFormat.PROGUARD_FILE, MappedElementKind.FIELD), null);
}});
PARAM_DEST_POS = register(
"parameter-destination-position",
Collections.emptyMap(),
new HashMap<Entry<MappingFormat, MappedElementKind>, String>() {{
put(new SimpleEntry<>(MappingFormat.MATCH_FILE, MappedElementKind.METHOD_ARG), null);
}});
}

private static StandardProperty register(String id, Map<MappingFormat, String> filePropNameByFormat,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.fabricmc.mappingio.MappingFlag;
import net.fabricmc.mappingio.MappingVisitor;
import net.fabricmc.mappingio.format.ColumnFileReader;
import net.fabricmc.mappingio.format.StandardProperties;

public class MatchFileReader {
public static void read(Reader reader, MappingVisitor visitor) throws IOException {
Expand Down Expand Up @@ -131,7 +132,7 @@ private static void readMethodContent(ColumnFileReader reader, boolean escapeNam
if (srcArgPos < 0 || dstArgPos < 0) throw new IOException("missing/invalid method arg position in line "+reader.getLineNumber());

if (visitor.visitMethodArg(srcArgPos, -1, null)) {
// TODO: Implement once per-element metadata is supported
visitor.visitElementMetadata(MappedElementKind.METHOD_ARG, StandardProperties.PARAM_DEST_POS.getId(), 0, String.valueOf(dstArgPos));
}
} else if (reader.nextCol("c")) { // comment: c <comment>
readComment(reader, MappedElementKind.METHOD, visitor);
Expand Down

0 comments on commit 10aeeb5

Please sign in to comment.