From 65628e9016e8036f3309a8ed0f8bb41b231ed68d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Tue, 12 Jul 2011 09:54:07 +0200 Subject: [PATCH] AS3: Correct method parameters names in decompiled code --- trunk/src/com/jpexs/asdec/abc/types/MethodBody.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java b/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java index a21632732..73ced1fd6 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java @@ -45,9 +45,13 @@ public class MethodBody implements Cloneable { return s; } - private String replaceParams(String code, MethodInfo method_info[]) { - for (int i = 1; i <= method_info[this.method_info].param_types.length; i++) { - code = code.replace(InstructionDefinition.localRegName(i), "param" + i); + private String replaceParams(String code, ABC abc) { + for (int i = 1; i <= abc.method_info[this.method_info].param_types.length; 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; } @@ -66,7 +70,7 @@ public class MethodBody implements Cloneable { }else{ try { s += code.toSource(isStatic, classIndex, abc, constants, method_info, this, hilight); - s = replaceParams(s, method_info); + s = replaceParams(s, abc); } catch (Exception ex) { s = "//error:" + ex.toString(); }