mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 12:30:46 +00:00
Display compound scripts in separate folders,
display script initializer separately. Show imported classes.
This commit is contained in:
@@ -112,7 +112,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
this.path = path;
|
||||
this.allABCs = allAbcs;
|
||||
}
|
||||
|
||||
|
||||
public DottedChain getPathPackage() {
|
||||
DottedChain packageName = DottedChain.TOPLEVEL;
|
||||
for (int t : traitIndices) {
|
||||
@@ -182,8 +182,8 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(sinit_bodyIndex));
|
||||
abc.bodies.get(sinit_bodyIndex).convert(callStack, abcIndex, convertData, path +/*packageName +*/ "/.scriptinitializer", exportMode, true, sinit_index, scriptIndex, -1, abc, null, new ScopeStack(), GraphTextWriter.TRAIT_SCRIPT_INITIALIZER, writer, new ArrayList<>(), ts, true, new HashSet<>());
|
||||
scriptInitializerIsEmpty = !writer.getMark();
|
||||
|
||||
scriptInitializerIsEmpty = !writer.getMark();
|
||||
|
||||
}
|
||||
ScopeStack scopeStack = new ScopeStack();
|
||||
scopeStack.push(new GlobalAVM2Item(null, null));
|
||||
@@ -206,7 +206,17 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
//script initializer
|
||||
int script_init = abc.script_info.get(scriptIndex).init_index;
|
||||
int bodyIndex = abc.findBodyIndex(script_init);
|
||||
if (bodyIndex != -1 && Configuration.enableScriptInitializerDisplay.get()) {
|
||||
|
||||
|
||||
if (!isSimple && traitIndices.isEmpty()) {
|
||||
for (Trait t : abc.script_info.get(scriptIndex).traits.traits) {
|
||||
String fullName = t.getName(abc).getNameWithNamespace(abc.constants, false).toPrintableString(true);
|
||||
writer.appendNoHilight("include(\"" + fullName.replace(".", "/") + ".as\");").newLine();
|
||||
}
|
||||
writer.newLine();
|
||||
}
|
||||
|
||||
if (bodyIndex != -1 && (isSimple || traitIndices.isEmpty())) { // && Configuration.enableScriptInitializerDisplay.get()) {
|
||||
//Note: There must be trait/method highlight even if the initializer is empty to TraitList in GUI to work correctly
|
||||
//TODO: handle this better in GUI(?)
|
||||
writer.startTrait(GraphTextWriter.TRAIT_SCRIPT_INITIALIZER);
|
||||
@@ -228,8 +238,6 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
writer.newLine();
|
||||
}
|
||||
first = false;
|
||||
} else {
|
||||
//"/*classInitializer*/";
|
||||
}
|
||||
|
||||
for (int t : traitIndices) {
|
||||
|
||||
@@ -103,6 +103,21 @@ public class ScriptInfo {
|
||||
otherTraits.add(j);
|
||||
}
|
||||
}
|
||||
|
||||
int publicTraitsCount = 0;
|
||||
for (int j = 0; j < traits.traits.size(); j++) {
|
||||
Trait t = traits.traits.get(j);
|
||||
Multiname name = t.getName(abc);
|
||||
int nskind = name.getSimpleNamespaceKind(abc.constants);
|
||||
if ((nskind == Namespace.KIND_PACKAGE_INTERNAL)
|
||||
|| (nskind == Namespace.KIND_PACKAGE)) {
|
||||
publicTraitsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isSimple = publicTraitsCount == 1;
|
||||
|
||||
|
||||
for (int j = 0; j < traits.traits.size(); j++) {
|
||||
Trait t = traits.traits.get(j);
|
||||
Multiname name = t.getName(abc);
|
||||
@@ -121,14 +136,14 @@ public class ScriptInfo {
|
||||
}
|
||||
|
||||
if (packagePrefix == null || packageName.toPrintableString(true).startsWith(packagePrefix)) {
|
||||
|
||||
ClassPath cp = new ClassPath(packageName, objectName, namespaceSuffix);
|
||||
ret.add(new ScriptPack(cp, abc, allAbcs, scriptIndex, traitIndices));
|
||||
ScriptPack pack = new ScriptPack(cp, abc, allAbcs, scriptIndex, traitIndices);
|
||||
pack.isSimple = isSimple;
|
||||
ret.add(pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret.size() == 1) {
|
||||
ret.get(0).isSimple = true;
|
||||
}
|
||||
}
|
||||
if (ret.isEmpty() && !otherTraits.isEmpty()) { //no public/package internal traits to determine common pack name
|
||||
//make each trait separate pack
|
||||
for (int traitIndex : otherTraits) {
|
||||
@@ -145,6 +160,9 @@ public class ScriptInfo {
|
||||
ClassPath cp = new ClassPath(packageName, objectName, namespaceSuffix);
|
||||
ret.add(new ScriptPack(cp, abc, allAbcs, scriptIndex, traitIndices));
|
||||
}
|
||||
}
|
||||
if (!isSimple) {
|
||||
ret.add(new ScriptPack(new ClassPath(DottedChain.EMPTY, "script_"+scriptIndex, ""), abc, allAbcs, scriptIndex, new ArrayList<>()));
|
||||
}
|
||||
if (packagePrefix == null) {
|
||||
cachedPacks = new ArrayList<>(ret);
|
||||
|
||||
Reference in New Issue
Block a user