Skip to content

Commit 1fc0b8e

Browse files
authored
Support local variable remapping (#114)
* Support local variables * Update copyright date
1 parent ae96754 commit 1fc0b8e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/java/net/fabricmc/tinyremapper/AsmRemapper.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2016, 2018, Player, asie
3-
* Copyright (c) 2018, 2021, FabricMC
3+
* Copyright (c) 2018, 2023, FabricMC
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -135,7 +135,8 @@ public String mapMethodArg(String methodOwner, String methodName, String methodD
135135
}
136136

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

141142
@Override

src/main/java/net/fabricmc/tinyremapper/TinyRemapper.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ public void acceptMethodVar(Member method, int lvIndex, int startOpIdx, int asmI
705705
if (method.desc == null) throw new NullPointerException("null src method desc");
706706
if (dstName == null) throw new NullPointerException("null dst name");
707707

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

711711
@Override
@@ -1411,6 +1411,7 @@ public void propagate(TrMember m, String newName) {
14111411
final Map<String, String> classMap = new HashMap<>();
14121412
final Map<String, String> methodMap = new HashMap<>();
14131413
final Map<String, String> methodArgMap = new HashMap<>();
1414+
final Map<String, String> methodVarMap = new HashMap<>();
14141415
final Map<String, String> fieldMap = new HashMap<>();
14151416
final Map<MemberInstance, Set<String>> conflicts = new ConcurrentHashMap<>();
14161417
final Set<ClassInstance> classesToMakePublic = Collections.newSetFromMap(new ConcurrentHashMap<>());

0 commit comments

Comments
 (0)