mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-15 09:33:59 +00:00
AS3: Parsing all traits inside scripts instead of just classes
This commit is contained in:
@@ -1610,8 +1610,8 @@ public class AVM2Code {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, HashMap<Integer, String> localRegNames, Stack<TreeItem> scopeStack,boolean isStaticInitializer) {
|
||||
return toSource(isStatic, classIndex, abc, constants, method_info, body, false, localRegNames, scopeStack,isStaticInitializer);
|
||||
public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, HashMap<Integer, String> localRegNames, Stack<TreeItem> scopeStack, boolean isStaticInitializer) {
|
||||
return toSource(isStatic, classIndex, abc, constants, method_info, body, false, localRegNames, scopeStack, isStaticInitializer);
|
||||
}
|
||||
|
||||
public List<TreeItem> toTree(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, HashMap<Integer, String> localRegNames) {
|
||||
@@ -1689,7 +1689,7 @@ public class AVM2Code {
|
||||
}
|
||||
}
|
||||
|
||||
public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, boolean hilighted, HashMap<Integer, String> localRegNames, Stack<TreeItem> scopeStack,boolean isStaticInitializer) {
|
||||
public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, boolean hilighted, HashMap<Integer, String> localRegNames, Stack<TreeItem> scopeStack, boolean isStaticInitializer) {
|
||||
toSourceCount = 0;
|
||||
loopList = new ArrayList<Loop>();
|
||||
unknownJumps = new ArrayList<Integer>();
|
||||
@@ -1712,20 +1712,20 @@ public class AVM2Code {
|
||||
|
||||
try {
|
||||
list = toSource(isStatic, classIndex, localRegs, new Stack<TreeItem>(), scopeStack, abc, constants, method_info, body, 0, code.size() - 1, localRegNames).output;
|
||||
if(isStaticInitializer){
|
||||
|
||||
List<TreeItem> newList=new ArrayList<TreeItem>();
|
||||
for(TreeItem ti:list){
|
||||
if(!(ti instanceof ReturnVoidTreeItem)){
|
||||
if(!(ti instanceof InitPropertyTreeItem)){
|
||||
if(!(ti instanceof SetPropertyTreeItem)){
|
||||
if (isStaticInitializer) {
|
||||
|
||||
List<TreeItem> newList = new ArrayList<TreeItem>();
|
||||
for (TreeItem ti : list) {
|
||||
if (!(ti instanceof ReturnVoidTreeItem)) {
|
||||
if (!(ti instanceof InitPropertyTreeItem)) {
|
||||
if (!(ti instanceof SetPropertyTreeItem)) {
|
||||
newList.add(ti);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
list=newList;
|
||||
if(list.isEmpty()){
|
||||
list = newList;
|
||||
if (list.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1750,7 +1750,7 @@ public class AVM2Code {
|
||||
if (!declaredSlots.contains(sl)) {
|
||||
String type = "*";
|
||||
for (int t = 0; t < body.traits.traits.length; t++) {
|
||||
if (body.traits.traits[t].getMultiName(constants) == sl.multiname) {
|
||||
if (body.traits.traits[t].getName(abc) == sl.multiname) {
|
||||
if (body.traits.traits[t] instanceof TraitSlotConst) {
|
||||
type = ((TraitSlotConst) body.traits.traits[t]).getType(constants);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user