public Dictionary <int, int> argTable; // new List<int>();//index->arg index //public Dictionary<int, int> localTable;//index->localIndex; public JavaMethod(JavaClass type, javaloader.ClassFile.Method method) { this.DeclaringType = type; this.method = method; //method.LocalVariableTableAttribute this.argTable = new Dictionary <int, int>(); //this.localTable = new Dictionary<int, int>(); if (method.ArgMap != null) { for (var i = 0; i < method.ArgMap.Length; i++) { var ind = method.ArgMap[i]; if (ind >= 0) { this.argTable[ind] = i; } } } scanTypes(method.Signature, out this.returnType, this.paramTypes); Dictionary <int, string> local = new Dictionary <int, string>(); if (this.method.LocalVariableTableAttribute != null) { foreach (var lv in this.method.LocalVariableTableAttribute) { var ind = lv.index; if (this.argTable.ContainsValue(ind) == false) { var desc = lv.name + ";" + lv.descriptor; if (local.ContainsKey(ind)) { local[ind] = local[ind] + "||" + desc; } else { local[ind] = desc; } } this.MaxVariableIndex = Math.Max(ind + 1, this.MaxVariableIndex); } } //for (var i = 0; i < local.Count; i++) //{ // this.localTable[local.Keys.ToArray()[i]] = i; //} { this.body_Variables = new List <QurasParam>(); //var addLocal_VariablesCount = this.method.MaxLocals - this.paramTypes.Count; //if (addLocal_VariablesCount < local.Count) //{ // throw new Exception("not impossible."); //} //for (var i = 0; i < addLocal_VariablesCount; i++) //{ // this.body_Variables.Add(new Param("_noname", "")); //} for (var i = 0; i < MaxVariableIndex; i++) { this.body_Variables.Add(new QurasParam("_noname", "")); } foreach (var lv in local) { this.body_Variables[lv.Key - this.paramTypes.Count] = new QurasParam("local", lv.Value); } } if (this.method.Instructions != null) { for (var i = 0; i < this.method.Instructions.Length; i++) { Instruction code = this.method.Instructions[i]; var opcode = new OpCode(); opcode.InitToken(this, code); this.body_Codes[code.PC] = opcode; } } // this.method.LocalVariableTableAttribute }