mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-08-02 14:41:23 +00:00
Fixed AS3 Initialization of var in script initializer
This commit is contained in:
@@ -104,14 +104,11 @@ public abstract class ActionScript3DecompileTestBase extends ActionScriptTestBas
|
||||
assertTrue(bodyIndex > -1);
|
||||
HighlightedTextWriter writer;
|
||||
try {
|
||||
List<Traits> ts = new ArrayList<>();
|
||||
ts.add(abc.instance_info.get(clsIndex).instance_traits);
|
||||
|
||||
Configuration.autoDeobfuscate.set(methodName.toLowerCase().contains("obfus"));
|
||||
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(bodyIndex));
|
||||
abc.bodies.get(bodyIndex).convert(callStack, swf.getAbcIndex(), new ConvertData(), "run", ScriptExportMode.AS, isStatic, abc.bodies.get(bodyIndex).method_info, scriptIndex, clsIndex, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), ts, true, new HashSet<>());
|
||||
abc.bodies.get(bodyIndex).convert(callStack, swf.getAbcIndex(), new ConvertData(), "run", ScriptExportMode.AS, isStatic, abc.bodies.get(bodyIndex).method_info, scriptIndex, clsIndex, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), abc.instance_info.get(clsIndex).instance_traits, true, new HashSet<>());
|
||||
writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
abc.bodies.get(bodyIndex).toString(callStack, swf.getAbcIndex(), "run", ScriptExportMode.AS, abc, null, writer, new ArrayList<>(), new HashSet<>());
|
||||
} catch (InterruptedException ex) {
|
||||
|
||||
@@ -558,4 +558,28 @@ public class ActionScript3ClassTest extends ActionScript3DecompileTestBase {
|
||||
+ " }\n"
|
||||
+ "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitializedVar() {
|
||||
decompileScriptPack("standard", "tests_classes.initializedvar", "package tests_classes\n"
|
||||
+ "{\n"
|
||||
+ " public var initializedvar:Object = {\n"
|
||||
+ " \"a\":1,\n"
|
||||
+ " \"b\":2,\n"
|
||||
+ " \"c\":3\n"
|
||||
+ " };\n"
|
||||
+ "}");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitializedConst() {
|
||||
decompileScriptPack("standard", "tests_classes.initializedconst", "package tests_classes\n"
|
||||
+ "{\n"
|
||||
+ " public const initializedconst:Object = {\n"
|
||||
+ " \"a\":1,\n"
|
||||
+ " \"b\":2,\n"
|
||||
+ " \"c\":3\n"
|
||||
+ " };\n"
|
||||
+ "}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1182,6 +1182,12 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportedConst() {
|
||||
decompileMethod("classic_air", "testImportedConst", "trace(29);\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportedVar() {
|
||||
decompileMethod("classic_air", "testImportedVar", "trace(myvar);\r\n"
|
||||
|
||||
@@ -1178,6 +1178,12 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportedConst() {
|
||||
decompileMethod("classic", "testImportedConst", "trace(myconst);\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportedVar() {
|
||||
decompileMethod("classic", "testImportedVar", "trace(myvar);\r\n"
|
||||
|
||||
@@ -156,14 +156,11 @@ public class AS3Generator {
|
||||
s.append("\", ");
|
||||
HighlightedTextWriter src = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
MethodBody b = abc.findBody(((TraitMethodGetterSetter) t).method_info);
|
||||
List<Traits> ts = new ArrayList<>();
|
||||
ts.add(abc.instance_info.get(classId).instance_traits);
|
||||
|
||||
Configuration.autoDeobfuscate.set(clsName.toLowerCase().contains("obfus"));
|
||||
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(b);
|
||||
b.convert(callStack, swf.getAbcIndex(), new ConvertData(), "", ScriptExportMode.AS, false, ((TraitMethodGetterSetter) t).method_info, pack.scriptIndex, classId, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), ts, true, new HashSet<>());
|
||||
b.convert(callStack, swf.getAbcIndex(), new ConvertData(), "", ScriptExportMode.AS, false, ((TraitMethodGetterSetter) t).method_info, pack.scriptIndex, classId, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), abc.instance_info.get(classId).instance_traits, true, new HashSet<>());
|
||||
b.toString(callStack, swf.getAbcIndex(), "", ScriptExportMode.AS, abc, null, src, new ArrayList<>(), new HashSet<>());
|
||||
String[] srcs = src.toString().split("[\r\n]+");
|
||||
for (int i = 0; i < srcs.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user