mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-24 23:21:21 +00:00
AS3: Local register types, inline functions / newactivation
This commit is contained in:
@@ -48,6 +48,7 @@ import com.jpexs.asdec.abc.avm2.treemodel.operations.PreIncrementTreeItem;
|
|||||||
import com.jpexs.asdec.abc.types.ABCException;
|
import com.jpexs.asdec.abc.types.ABCException;
|
||||||
import com.jpexs.asdec.abc.types.MethodBody;
|
import com.jpexs.asdec.abc.types.MethodBody;
|
||||||
import com.jpexs.asdec.abc.types.MethodInfo;
|
import com.jpexs.asdec.abc.types.MethodInfo;
|
||||||
|
import com.jpexs.asdec.abc.types.traits.TraitSlotConst;
|
||||||
import com.jpexs.asdec.helpers.Helper;
|
import com.jpexs.asdec.helpers.Helper;
|
||||||
import com.jpexs.asdec.helpers.Highlighting;
|
import com.jpexs.asdec.helpers.Highlighting;
|
||||||
|
|
||||||
@@ -1871,7 +1872,16 @@ public HashMap<Integer,String> getLocalRegNamesFromDebug(ABC abc){
|
|||||||
String sub = "";
|
String sub = "";
|
||||||
int level = 0;
|
int level = 0;
|
||||||
for (int t = 0; t < body.traits.traits.length; t++) {
|
for (int t = 0; t < body.traits.traits.length; t++) {
|
||||||
sub += body.traits.traits[t].convert(constants, method_info,abc) + ";\r\n";
|
//Skip traits with same name as local registers
|
||||||
|
if(
|
||||||
|
(body.traits.traits[t] instanceof TraitSlotConst)
|
||||||
|
&&(((TraitSlotConst)body.traits.traits[t]).isVar())
|
||||||
|
&&(localRegNames.containsValue(((TraitSlotConst)body.traits.traits[t]).getName(constants))))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}else{
|
||||||
|
sub += body.traits.traits[t].convert(constants, method_info,abc) + ";\r\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int regCount=getRegisterCount();
|
int regCount=getRegisterCount();
|
||||||
int paramCount=0;
|
int paramCount=0;
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import com.jpexs.asdec.abc.avm2.ConstantPool;
|
|||||||
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
|
import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction;
|
||||||
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
|
import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition;
|
||||||
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
|
import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns;
|
||||||
|
import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem;
|
||||||
import com.jpexs.asdec.abc.avm2.treemodel.SetSlotTreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.SetSlotTreeItem;
|
||||||
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.TreeItem;
|
||||||
import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem;
|
import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem;
|
||||||
@@ -59,6 +60,14 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if new activation sets params of the function
|
||||||
|
if(obj instanceof NewActivationTreeItem){
|
||||||
|
if(localRegNames.containsValue(slotname.getName(constants))){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
output.add(new SetSlotTreeItem(ins, obj, slotname, value));
|
output.add(new SetSlotTreeItem(ins, obj, slotname, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,16 @@ public class CallTreeItem extends TreeItem {
|
|||||||
}
|
}
|
||||||
args = args + arguments.get(a).toString(constants,localRegNames);
|
args = args + arguments.get(a).toString(constants,localRegNames);
|
||||||
}
|
}
|
||||||
return receiver.toString(constants,localRegNames) + hilight(".") + function.toString(constants,localRegNames) + hilight("(") + args + hilight(")");
|
String recPart=receiver.toString(constants,localRegNames) + hilight(".");
|
||||||
|
if(receiver instanceof NewActivationTreeItem)
|
||||||
|
{
|
||||||
|
recPart="";
|
||||||
|
}
|
||||||
|
if(receiver instanceof ThisTreeItem)
|
||||||
|
{
|
||||||
|
recPart="";
|
||||||
|
}
|
||||||
|
return recPart+ function.toString(constants,localRegNames) + hilight("(") + args + hilight(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,14 @@ public class TraitSlotConst extends Trait {
|
|||||||
if (kindType == TRAIT_CONST) {
|
if (kindType == TRAIT_CONST) {
|
||||||
slotconst = "const";
|
slotconst = "const";
|
||||||
}
|
}
|
||||||
return slotconst + " " + constants.constant_multiname[name_index].getName(constants) + ":" + typeStr + valueStr;
|
return slotconst + " " + getName(constants) + ":" + typeStr + valueStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName(ConstantPool constants)
|
||||||
|
{
|
||||||
|
return constants.constant_multiname[name_index].getName(constants);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convert(ConstantPool constants, MethodInfo[] methodInfo,ABC abc, boolean isStatic) {
|
public String convert(ConstantPool constants, MethodInfo[] methodInfo,ABC abc, boolean isStatic) {
|
||||||
String modifier = getModifiers(constants, isStatic) + " ";
|
String modifier = getModifiers(constants, isStatic) + " ";
|
||||||
|
|||||||
Reference in New Issue
Block a user