mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 23:21:36 +00:00
Issue #216 AS2 field order fix
This commit is contained in:
@@ -1846,8 +1846,12 @@ public class SWF {
|
||||
|
||||
|
||||
List<GraphTargetItem> vars = new ArrayList<>();
|
||||
vars.addAll(cti.vars.keySet());
|
||||
vars.addAll(cti.staticVars.keySet());
|
||||
for (KeyValue<GraphTargetItem, GraphTargetItem> item : cti.vars) {
|
||||
vars.add(item.key);
|
||||
}
|
||||
for (KeyValue<GraphTargetItem, GraphTargetItem> item : cti.staticVars) {
|
||||
vars.add(item.key);
|
||||
}
|
||||
for (GraphTargetItem gti : vars) {
|
||||
if (gti instanceof DirectValueTreeItem) {
|
||||
DirectValueTreeItem dvf = (DirectValueTreeItem) gti;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.jpexs.decompiler.flash.action;
|
||||
|
||||
import com.jpexs.decompiler.flash.DisassemblyListener;
|
||||
import com.jpexs.decompiler.flash.KeyValue;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFInputStream;
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
@@ -985,8 +986,8 @@ public class Action implements GraphSourceItem {
|
||||
List<GraphTargetItem> ret = new ArrayList<>();
|
||||
List<GraphTargetItem> functions = new ArrayList<>();
|
||||
List<GraphTargetItem> staticFunctions = new ArrayList<>();
|
||||
HashMap<GraphTargetItem, GraphTargetItem> vars = new HashMap<>();
|
||||
HashMap<GraphTargetItem, GraphTargetItem> staticVars = new HashMap<>();
|
||||
List<KeyValue<GraphTargetItem, GraphTargetItem>> vars = new ArrayList<>();
|
||||
List<KeyValue<GraphTargetItem, GraphTargetItem>> staticVars = new ArrayList<>();
|
||||
GraphTargetItem className;
|
||||
GraphTargetItem extendsOp = null;
|
||||
List<GraphTargetItem> implementsOp = new ArrayList<>();
|
||||
@@ -1143,14 +1144,14 @@ public class Action implements GraphSourceItem {
|
||||
((FunctionTreeItem) smt.value).calculatedFunctionName = smt.objectName;
|
||||
functions.add((FunctionTreeItem) smt.value);
|
||||
} else {
|
||||
vars.put(smt.objectName, smt.value);
|
||||
vars.add(new KeyValue<>(smt.objectName, smt.value));
|
||||
}
|
||||
} else if (((RegisterNumber) ((DirectValueTreeItem) smt.object).value).number == classReg) {
|
||||
if (smt.value instanceof FunctionTreeItem) {
|
||||
((FunctionTreeItem) smt.value).calculatedFunctionName = smt.objectName;
|
||||
staticFunctions.add((FunctionTreeItem) smt.value);
|
||||
} else {
|
||||
staticVars.put(smt.objectName, smt.value);
|
||||
staticVars.add(new KeyValue<>(smt.objectName, smt.value));
|
||||
}
|
||||
} else {
|
||||
ok = false;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.action.treemodel.clauses;
|
||||
|
||||
import com.jpexs.decompiler.flash.KeyValue;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.treemodel.TreeItem;
|
||||
@@ -34,8 +35,8 @@ public class ClassTreeItem extends TreeItem implements Block {
|
||||
public GraphTargetItem extendsOp;
|
||||
public List<GraphTargetItem> implementsOp;
|
||||
public GraphTargetItem className;
|
||||
public HashMap<GraphTargetItem, GraphTargetItem> vars;
|
||||
public HashMap<GraphTargetItem, GraphTargetItem> staticVars;
|
||||
public List<KeyValue<GraphTargetItem, GraphTargetItem>> vars;
|
||||
public List<KeyValue<GraphTargetItem, GraphTargetItem>> staticVars;
|
||||
|
||||
@Override
|
||||
public List<List<GraphTargetItem>> getSubs() {
|
||||
@@ -45,7 +46,7 @@ public class ClassTreeItem extends TreeItem implements Block {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ClassTreeItem(GraphTargetItem className, GraphTargetItem extendsOp, List<GraphTargetItem> implementsOp, List<GraphTargetItem> functions, HashMap<GraphTargetItem, GraphTargetItem> vars, List<GraphTargetItem> staticFunctions, HashMap<GraphTargetItem, GraphTargetItem> staticVars) {
|
||||
public ClassTreeItem(GraphTargetItem className, GraphTargetItem extendsOp, List<GraphTargetItem> implementsOp, List<GraphTargetItem> functions, List<KeyValue<GraphTargetItem, GraphTargetItem>> vars, List<GraphTargetItem> staticFunctions, List<KeyValue<GraphTargetItem, GraphTargetItem>> staticVars) {
|
||||
super(null, NOPRECEDENCE);
|
||||
this.className = className;
|
||||
this.functions = functions;
|
||||
@@ -81,11 +82,11 @@ public class ClassTreeItem extends TreeItem implements Block {
|
||||
for (GraphTargetItem f : staticFunctions) {
|
||||
ret += "static " + f.toString(constants) + "\r\n";
|
||||
}
|
||||
for (GraphTargetItem v : vars.keySet()) {
|
||||
ret += "var " + v.toStringNoQuotes(constants) + " = " + vars.get(v).toStringNoQuotes(constants) + ";\r\n";
|
||||
for (KeyValue<GraphTargetItem, GraphTargetItem> item : vars) {
|
||||
ret += "var " + item.key.toStringNoQuotes(constants) + " = " + item.value.toStringNoQuotes(constants) + ";\r\n";
|
||||
}
|
||||
for (GraphTargetItem v : staticVars.keySet()) {
|
||||
ret += "static var " + v.toStringNoQuotes(constants) + " = " + staticVars.get(v).toStringNoQuotes(constants) + ";\r\n";
|
||||
for (KeyValue<GraphTargetItem, GraphTargetItem> item : staticVars) {
|
||||
ret += "static var " + item.key.toStringNoQuotes(constants) + " = " + item.value.toStringNoQuotes(constants) + ";\r\n";
|
||||
}
|
||||
ret += "}\r\n";
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user