summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/mapping
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cuchaz/enigma/mapping')
-rw-r--r--src/main/java/cuchaz/enigma/mapping/Translator.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/java/cuchaz/enigma/mapping/Translator.java b/src/main/java/cuchaz/enigma/mapping/Translator.java
index de48c9a..125e03f 100644
--- a/src/main/java/cuchaz/enigma/mapping/Translator.java
+++ b/src/main/java/cuchaz/enigma/mapping/Translator.java
@@ -203,22 +203,29 @@ public class Translator {
203 throw new Error("Wrong entry type!"); 203 throw new Error("Wrong entry type!");
204 } 204 }
205 205
206 // TODO: support not identical behavior (specific to constructor)
206 public String translate(ArgumentEntry in) { 207 public String translate(ArgumentEntry in) {
207 208
208 // look for the class 209 // look for identical behavior in superclasses
209 ClassMapping classMapping = findClassMapping(in.getClassEntry()); 210 ClassEntry entry = this.index.resolveEntryClass(in, true);
210 if (classMapping != null) {
211 211
212 // look for the method 212 if (entry != null)
213 MethodMapping methodMapping = this.direction.choose( 213 {
214 classMapping.getMethodByObf(in.getMethodName(), in.getMethodSignature()), 214 // look for the class
215 classMapping.getMethodByDeobf(in.getMethodName(), translateSignature(in.getMethodSignature())) 215 ClassMapping classMapping = findClassMapping(entry);
216 ); 216 if (classMapping != null) {
217 if (methodMapping != null) { 217
218 return this.direction.choose( 218 // look for the method
219 methodMapping.getDeobfArgumentName(in.getIndex()), 219 MethodMapping methodMapping = this.direction.choose(
220 methodMapping.getObfArgumentName(in.getIndex()) 220 classMapping.getMethodByObf(in.getMethodName(), in.getMethodSignature()),
221 classMapping.getMethodByDeobf(in.getMethodName(), translateSignature(in.getMethodSignature()))
221 ); 222 );
223 if (methodMapping != null) {
224 return this.direction.choose(
225 methodMapping.getDeobfArgumentName(in.getIndex()),
226 methodMapping.getObfArgumentName(in.getIndex())
227 );
228 }
222 } 229 }
223 } 230 }
224 return null; 231 return null;