mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 22:50:55 +00:00
@@ -23,91 +23,91 @@ import java.util.List;
|
||||
|
||||
public class FunctionTreeItem extends TreeItem {
|
||||
|
||||
public List<GraphTargetItem> actions;
|
||||
public List<String> constants;
|
||||
public String functionName;
|
||||
public List<String> paramNames;
|
||||
public GraphTargetItem calculatedFunctionName;
|
||||
private int regStart;
|
||||
public List<GraphTargetItem> actions;
|
||||
public List<String> constants;
|
||||
public String functionName;
|
||||
public List<String> paramNames;
|
||||
public GraphTargetItem calculatedFunctionName;
|
||||
private int regStart;
|
||||
|
||||
public FunctionTreeItem(GraphSourceItem instruction, String functionName, List<String> paramNames, List<GraphTargetItem> actions, List<String> constants, int regStart) {
|
||||
super(instruction, PRECEDENCE_PRIMARY);
|
||||
this.actions = actions;
|
||||
this.constants = constants;
|
||||
this.functionName = functionName;
|
||||
this.paramNames = paramNames;
|
||||
this.regStart = regStart;
|
||||
}
|
||||
public FunctionTreeItem(GraphSourceItem instruction, String functionName, List<String> paramNames, List<GraphTargetItem> actions, List<String> constants, int regStart) {
|
||||
super(instruction, PRECEDENCE_PRIMARY);
|
||||
this.actions = actions;
|
||||
this.constants = constants;
|
||||
this.functionName = functionName;
|
||||
this.paramNames = paramNames;
|
||||
this.regStart = regStart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (true) {
|
||||
//return "<func>";
|
||||
}
|
||||
String ret = hilight("function");
|
||||
if (calculatedFunctionName != null) {
|
||||
ret += " " + calculatedFunctionName.toStringNoQuotes(constants);
|
||||
} else if (!functionName.equals("")) {
|
||||
ret += " " + functionName;
|
||||
}
|
||||
ret += hilight("(");
|
||||
for (int p = 0; p < paramNames.size(); p++) {
|
||||
if (p > 0) {
|
||||
ret += hilight(", ");
|
||||
}
|
||||
String pname = paramNames.get(p);
|
||||
if (pname == null || pname.equals("")) {
|
||||
pname = "register" + (regStart + p);
|
||||
}
|
||||
ret += hilight(pname);
|
||||
}
|
||||
ret += hilight(")") + "\r\n{\r\n" + Graph.graphToString(actions, constants) + "}";
|
||||
return ret;
|
||||
}
|
||||
@Override
|
||||
public String toString(ConstantPool constants) {
|
||||
if (true) {
|
||||
//return "<func>";
|
||||
}
|
||||
String ret = hilight("function");
|
||||
if (calculatedFunctionName != null) {
|
||||
ret += " " + calculatedFunctionName.toStringNoQuotes(constants);
|
||||
} else if (!functionName.equals("")) {
|
||||
ret += " " + functionName;
|
||||
}
|
||||
ret += hilight("(");
|
||||
for (int p = 0; p < paramNames.size(); p++) {
|
||||
if (p > 0) {
|
||||
ret += hilight(", ");
|
||||
}
|
||||
String pname = paramNames.get(p);
|
||||
if (pname == null || pname.equals("")) {
|
||||
pname = "register" + (regStart + p);
|
||||
}
|
||||
ret += hilight(pname);
|
||||
}
|
||||
ret += hilight(")") + "\r\n{\r\n" + Graph.graphToString(actions, constants) + "}";
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<com.jpexs.decompiler.flash.graph.GraphSourceItemPos> getNeededSources() {
|
||||
List<com.jpexs.decompiler.flash.graph.GraphSourceItemPos> ret = super.getNeededSources();
|
||||
for (GraphTargetItem ti : actions) {
|
||||
ret.addAll(ti.getNeededSources());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@Override
|
||||
public List<com.jpexs.decompiler.flash.graph.GraphSourceItemPos> getNeededSources() {
|
||||
List<com.jpexs.decompiler.flash.graph.GraphSourceItemPos> ret = super.getNeededSources();
|
||||
for (GraphTargetItem ti : actions) {
|
||||
ret.addAll(ti.getNeededSources());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsSemicolon() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean needsSemicolon() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
for (GraphTargetItem a : actions) {
|
||||
if (!a.isCompileTime()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isCompileTime() {
|
||||
for (GraphTargetItem a : actions) {
|
||||
if (!a.isCompileTime()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
if (!actions.isEmpty()) {
|
||||
if (actions.get(actions.size() - 1) instanceof ReturnTreeItem) {
|
||||
ReturnTreeItem r = (ReturnTreeItem) actions.get(actions.size() - 1);
|
||||
return r.value.toBoolean();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean toBoolean() {
|
||||
if (!actions.isEmpty()) {
|
||||
if (actions.get(actions.size() - 1) instanceof ReturnTreeItem) {
|
||||
ReturnTreeItem r = (ReturnTreeItem) actions.get(actions.size() - 1);
|
||||
return r.value.toBoolean();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double toNumber() {
|
||||
if (!actions.isEmpty()) {
|
||||
if (actions.get(actions.size() - 1) instanceof ReturnTreeItem) {
|
||||
ReturnTreeItem r = (ReturnTreeItem) actions.get(actions.size() - 1);
|
||||
return r.value.toNumber();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public double toNumber() {
|
||||
if (!actions.isEmpty()) {
|
||||
if (actions.get(actions.size() - 1) instanceof ReturnTreeItem) {
|
||||
ReturnTreeItem r = (ReturnTreeItem) actions.get(actions.size() - 1);
|
||||
return r.value.toNumber();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user