Skip to content

Commit

Permalink
Support local variable remapping (#114)
Browse files Browse the repository at this point in the history
* Support local variables

* Update copyright date
  • Loading branch information
NebelNidas authored Jan 20, 2025
1 parent ae96754 commit 1fc0b8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/java/net/fabricmc/tinyremapper/AsmRemapper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, 2018, Player, asie
* Copyright (c) 2018, 2021, FabricMC
* Copyright (c) 2018, 2023, FabricMC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -135,7 +135,8 @@ public String mapMethodArg(String methodOwner, String methodName, String methodD
}

public String mapMethodVar(String methodOwner, String methodName, String methodDesc, int lvIndex, int startOpIdx, int asmIndex, String name) {
return name; // TODO: implement
String newName = tr.methodVarMap.get(methodOwner+"/"+MemberInstance.getMethodId(methodName, methodDesc)+lvIndex);
return newName != null ? newName : name;
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/fabricmc/tinyremapper/TinyRemapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ public void acceptMethodVar(Member method, int lvIndex, int startOpIdx, int asmI
if (method.desc == null) throw new NullPointerException("null src method desc");
if (dstName == null) throw new NullPointerException("null dst name");

// TODO Auto-generated method stub
methodVarMap.put(method.owner+"/"+MemberInstance.getMethodId(method.name, method.desc)+lvIndex, dstName);
}

@Override
Expand Down Expand Up @@ -1411,6 +1411,7 @@ public void propagate(TrMember m, String newName) {
final Map<String, String> classMap = new HashMap<>();
final Map<String, String> methodMap = new HashMap<>();
final Map<String, String> methodArgMap = new HashMap<>();
final Map<String, String> methodVarMap = new HashMap<>();
final Map<String, String> fieldMap = new HashMap<>();
final Map<MemberInstance, Set<String>> conflicts = new ConcurrentHashMap<>();
final Set<ClassInstance> classesToMakePublic = Collections.newSetFromMap(new ConcurrentHashMap<>());
Expand Down

0 comments on commit 1fc0b8e

Please sign in to comment.