AS3: Correct method parameters names in decompiled code

This commit is contained in:
Jindra Pet��k
2011-07-12 09:54:07 +02:00
parent 1f25be9236
commit 65628e9016
@@ -45,9 +45,13 @@ public class MethodBody implements Cloneable {
return s; return s;
} }
private String replaceParams(String code, MethodInfo method_info[]) { private String replaceParams(String code, ABC abc) {
for (int i = 1; i <= method_info[this.method_info].param_types.length; i++) { for (int i = 1; i <= abc.method_info[this.method_info].param_types.length; i++) {
code = code.replace(InstructionDefinition.localRegName(i), "param" + i); String paramName="param"+i;
if(abc.method_info[this.method_info].flagHas_paramnames()){
paramName=abc.constants.constant_string[abc.method_info[this.method_info].paramNames[i-1]];
}
code = code.replace(InstructionDefinition.localRegName(i), paramName);
} }
return code; return code;
} }
@@ -66,7 +70,7 @@ public class MethodBody implements Cloneable {
}else{ }else{
try { try {
s += code.toSource(isStatic, classIndex, abc, constants, method_info, this, hilight); s += code.toSource(isStatic, classIndex, abc, constants, method_info, this, hilight);
s = replaceParams(s, method_info); s = replaceParams(s, abc);
} catch (Exception ex) { } catch (Exception ex) {
s = "//error:" + ex.toString(); s = "//error:" + ex.toString();
} }