From 9c38f4dca1258544540e70bf4e7777f9a4bcd2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 18 Jan 2021 19:14:51 +0100 Subject: [PATCH] AS3 test methods separated to classes, Fixed AS3: get/set slot for global scope --- .../src/com/jpexs/decompiler/flash/SWF.java | 4 +- .../decompiler/flash/abc/ScriptPack.java | 2 +- .../flash/abc/avm2/graph/AVM2Graph.java | 3 +- .../instructions/other/GetGlobalScopeIns.java | 11 +- .../avm2/instructions/other/GetSlotIns.java | 8 +- .../avm2/instructions/other/SetSlotIns.java | 7 +- .../abc/avm2/model/NewFunctionAVM2Item.java | 5 +- .../flash/abc/avm2/model/ScriptAVM2Item.java | 3 +- .../flash/abc/types/MethodBody.java | 4 +- .../flash/abc/types/traits/TraitClass.java | 7 +- .../flash/abc/types/traits/TraitFunction.java | 5 +- .../types/traits/TraitMethodGetterSetter.java | 5 +- .../exporters/script/AS3ScriptExporter.java | 9 +- .../decompiler/flash/xfl/XFLConverter.java | 4 +- .../src/com/jpexs/decompiler/graph/Graph.java | 33 ++-- .../jpexs/decompiler/graph/ScopeStack.java | 10 +- .../decompiler/flash/ActionScript3Test.java | 144 ++++++++++++------ .../flash/generators/AS3Generator.java | 91 +++++------ .../flashdevelop/bin/expressInstall.swf | Bin 0 -> 773 bytes .../flashdevelop/bin/flashdevelop.swf | Bin 0 -> 14932 bytes .../testdata/flashdevelop/bin/index.html | 40 +++++ .../testdata/flashdevelop/bin/js/swfobject.js | 4 + .../flashdevelop/flashdevelop.as3proj | 93 +++++++++++ .../flashdevelop/obj/flashdevelopConfig.old | 48 ++++++ .../flashdevelop/obj/flashdevelopConfig.xml | 48 ++++++ .../testdata/flashdevelop/src/Main.as | 91 +++++++++++ .../flashdevelop/src/tests/TestArguments.as | 11 ++ .../src/tests/TestCatchFinally.as | 24 +++ .../flashdevelop/src/tests/TestChain2.as | 30 ++++ .../src/tests/TestChainedAssignments.as | 49 ++++++ .../src/tests/TestComplexExpressions.as | 13 ++ .../src/tests/TestContinueLevels.as | 66 ++++++++ .../flashdevelop/src/tests/TestDecl2.as | 21 +++ .../src/tests/TestDeclarations.as | 30 ++++ .../src/tests/TestDefaultNotLastGrouped.as | 23 +++ .../flashdevelop/src/tests/TestDoWhile.as | 17 +++ .../flashdevelop/src/tests/TestDoWhile2.as | 26 ++++ .../flashdevelop/src/tests/TestExpressions.as | 27 ++++ .../src/tests/TestFinallyZeroJump.as | 27 ++++ .../flashdevelop/src/tests/TestFor.as | 14 ++ .../flashdevelop/src/tests/TestForBreak.as | 18 +++ .../flashdevelop/src/tests/TestForContinue.as | 33 ++++ .../flashdevelop/src/tests/TestForEach.as | 20 +++ .../src/tests/TestForEachObjectArray.as | 22 +++ .../src/tests/TestForEachObjectAttribute.as | 21 +++ .../flashdevelop/src/tests/TestForIn.as | 21 +++ .../flashdevelop/src/tests/TestHello.as | 11 ++ .../testdata/flashdevelop/src/tests/TestIf.as | 15 ++ .../flashdevelop/src/tests/TestIfElse.as | 19 +++ .../flashdevelop/src/tests/TestInc2.as | 23 +++ .../flashdevelop/src/tests/TestIncDec.as | 49 ++++++ .../src/tests/TestInlineFunctions.as | 25 +++ .../src/tests/TestInnerFunctions.as | 21 +++ .../flashdevelop/src/tests/TestInnerIf.as | 33 ++++ .../flashdevelop/src/tests/TestInnerTry.as | 30 ++++ .../src/tests/TestLogicalComputing.as | 19 +++ .../src/tests/TestManualConvert.as | 12 ++ .../src/tests/TestMissingDefault.as | 22 +++ .../src/tests/TestMultipleCondition.as | 21 +++ .../src/tests/TestNamedAnonFunctions.as | 19 +++ .../flashdevelop/src/tests/TestNames.as | 32 ++++ .../src/tests/TestOptionalParameters.as | 12 ++ .../flashdevelop/src/tests/TestParamNames.as | 11 ++ .../flashdevelop/src/tests/TestParamsCount.as | 11 ++ .../flashdevelop/src/tests/TestPrecedence.as | 22 +++ .../flashdevelop/src/tests/TestPrecedenceX.as | 15 ++ .../flashdevelop/src/tests/TestProperty.as | 27 ++++ .../flashdevelop/src/tests/TestRegExp.as | 14 ++ .../flashdevelop/src/tests/TestRest.as | 12 ++ .../src/tests/TestStringConcat.as | 19 +++ .../flashdevelop/src/tests/TestStrings.as | 15 ++ .../flashdevelop/src/tests/TestSwitch.as | 24 +++ .../src/tests/TestSwitchDefault.as | 27 ++++ .../src/tests/TestTernarOperator.as | 16 ++ .../flashdevelop/src/tests/TestTry.as | 30 ++++ .../flashdevelop/src/tests/TestTryReturn.as | 37 +++++ .../flashdevelop/src/tests/TestVector.as | 15 ++ .../flashdevelop/src/tests/TestVector2.as | 12 ++ .../flashdevelop/src/tests/TestWhileAnd.as | 19 +++ .../src/tests/TestWhileContinue.as | 27 ++++ .../flashdevelop/src/tests/TestWhileTry.as | 29 ++++ .../flashdevelop/src/tests/TestWhileTry2.as | 32 ++++ .../mypackage1/SetupMyPackage1.as | 17 +++ .../src/tests_classes/mypackage1/TestClass.as | 27 ++++ .../tests_classes/mypackage1/TestClass2.as | 36 +++++ .../tests_classes/mypackage1/TestInterface.as | 9 ++ .../tests_classes/mypackage1/myNamespace.as | 4 + .../mypackage2/SetupMyPackage2.as | 15 ++ .../src/tests_classes/mypackage2/TestClass.as | 15 ++ .../tests_classes/mypackage2/TestInterface.as | 7 + .../mypackage3/SetupMyPackage3.as | 15 ++ .../src/tests_classes/mypackage3/TestClass.as | 12 ++ .../tests_classes/mypackage3/TestInterface.as | 7 + .../src/tests_other/myInternal.as | 4 + 94 files changed, 1999 insertions(+), 138 deletions(-) create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/bin/expressInstall.swf create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/bin/index.html create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/bin/js/swfobject.js create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/flashdevelop.as3proj create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/Main.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestArguments.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestCatchFinally.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChain2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChainedAssignments.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestComplexExpressions.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestContinueLevels.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDecl2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDeclarations.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDefaultNotLastGrouped.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestExpressions.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFinallyZeroJump.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFor.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForBreak.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForContinue.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEach.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectArray.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectAttribute.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForIn.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestHello.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIf.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIfElse.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInc2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIncDec.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInlineFunctions.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerFunctions.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerIf.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerTry.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestLogicalComputing.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestManualConvert.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMissingDefault.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMultipleCondition.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNamedAnonFunctions.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNames.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestOptionalParameters.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamNames.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamsCount.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedence.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedenceX.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestProperty.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRegExp.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRest.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStringConcat.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStrings.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitch.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitchDefault.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTernarOperator.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTry.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTryReturn.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileAnd.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileContinue.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/SetupMyPackage1.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestInterface.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/myNamespace.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/SetupMyPackage2.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestClass.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestInterface.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/SetupMyPackage3.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestClass.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestInterface.as create mode 100644 libsrc/ffdec_lib/testdata/flashdevelop/src/tests_other/myInternal.as diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 1aee4ddb8..349d2fd86 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -3636,7 +3636,7 @@ public final class SWF implements SWFContainerItem, Timelined { int mi = ((TraitMethodGetterSetter) t).method_info; try { - documentPack.abc.findBody(mi).convert(new ConvertData(), "??", ScriptExportMode.AS, true, mi, documentPack.scriptIndex, cindex, documentPack.abc, t, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + documentPack.abc.findBody(mi).convert(new ConvertData(), "??", ScriptExportMode.AS, true, mi, documentPack.scriptIndex, cindex, documentPack.abc, t, new ScopeStack(documentPack.scriptIndex), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); List infos = documentPack.abc.findBody(mi).convertedItems; if (!infos.isEmpty()) { if (infos.get(0) instanceof IfItem) { @@ -3712,7 +3712,7 @@ public final class SWF implements SWFContainerItem, Timelined { if (tr instanceof TraitClass) { int ci = ((TraitClass) tr).class_info; int cinit = p.abc.class_info.get(ci).cinit_index; - p.abc.findBody(cinit).convert(new ConvertData(), "??", ScriptExportMode.AS, true, cinit, p.scriptIndex, cindex, p.abc, t, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + p.abc.findBody(cinit).convert(new ConvertData(), "??", ScriptExportMode.AS, true, cinit, p.scriptIndex, cindex, p.abc, t, new ScopeStack(p.scriptIndex), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); List cinitBody = p.abc.findBody(cinit).convertedItems; for (GraphTargetItem cit : cinitBody) { if (cit instanceof SetPropertyAVM2Item) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java index 8fdf45acc..bb0feee3a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java @@ -176,7 +176,7 @@ public class ScriptPack extends AS3ClassTreeItem { } ts.add(abc.script_info.get(scriptIndex).traits); writer.mark(); - abc.bodies.get(sinit_bodyIndex).convert(convertData, path +/*packageName +*/ "/.scriptinitializer", exportMode, true, sinit_index, scriptIndex, -1, abc, null, new ScopeStack(), GraphTextWriter.TRAIT_SCRIPT_INITIALIZER, writer, new ArrayList<>(), ts, true); + abc.bodies.get(sinit_bodyIndex).convert(convertData, path +/*packageName +*/ "/.scriptinitializer", exportMode, true, sinit_index, scriptIndex, -1, abc, null, new ScopeStack(scriptIndex), GraphTextWriter.TRAIT_SCRIPT_INITIALIZER, writer, new ArrayList<>(), ts, true); scriptInitializerIsEmpty = !writer.getMark(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java index eba081d0a..e4d1286d4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java @@ -39,6 +39,7 @@ import com.jpexs.decompiler.flash.abc.avm2.model.NextValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NullAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ReturnValueAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.ReturnVoidAVM2Item; +import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetLocalAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.SetTypeAVM2Item; @@ -338,7 +339,7 @@ public class AVM2Graph extends Graph { st2.clear(); st2.add(new ExceptionAVM2Item(catchedExceptions.get(e))); AVM2LocalData localData2 = new AVM2LocalData(aLocalData); - localData2.scopeStack = new ScopeStack(); + localData2.scopeStack = new ScopeStack(localData2.scriptIndex); List stopPart2 = new ArrayList<>(stopPart); stopPart2.add(nepart); if (retPart != null) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java index d19c2e846..478f6e436 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.instructions.other; import com.jpexs.decompiler.flash.abc.ABC; @@ -45,11 +46,13 @@ public class GetGlobalScopeIns extends InstructionDefinition { @Override public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List output, String path) { if (localData.scopeStack.isEmpty()) { - if (localData.classIndex == -1) { - stack.push(new ScriptAVM2Item(localData.scriptIndex)); + /*if (localData.classIndex == -1) { + } else { stack.push(new ClassAVM2Item(localData.getInstanceInfo().get(localData.classIndex).getName(localData.getConstants()))); - } + }*/ + //FIXME?? + stack.push(new ScriptAVM2Item(localData.scriptIndex)); return; } stack.push(localData.scopeStack.get(0)); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java index 1ed21788a..a29e0f264 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java @@ -53,12 +53,8 @@ public class GetSlotIns extends InstructionDefinition { Multiname slotname = null; if (obj instanceof ExceptionAVM2Item) { slotname = localData.getConstants().getMultiname(((ExceptionAVM2Item) obj).exception.name_index); - } else if (obj instanceof ClassAVM2Item) { - slotname = ((ClassAVM2Item) obj).className; - } else if (obj instanceof ThisAVM2Item) { - slotname = ((ThisAVM2Item) obj).classMultiname; - } else if (obj instanceof ScriptAVM2Item) { - List traits = localData.getScriptInfo().get(((ScriptAVM2Item) obj).scriptIndex).traits.traits; + } else if ((obj instanceof ThisAVM2Item) || (obj instanceof ClassAVM2Item) || (obj instanceof ScriptAVM2Item)) { + List traits = localData.getScriptInfo().get(localData.scriptIndex).traits.traits; for (int t = 0; t < traits.size(); t++) { Trait tr = traits.get(t); if (tr instanceof TraitWithSlot) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java index e847ccf32..6e32e1920 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java @@ -73,12 +73,9 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns { if (obj instanceof ExceptionAVM2Item) { slotname = localData.getConstants().getMultiname(((ExceptionAVM2Item) obj).exception.name_index); - } else if (obj instanceof ClassAVM2Item) { - slotname = ((ClassAVM2Item) obj).className; - } else if (obj instanceof ThisAVM2Item) { + } else if ((obj instanceof ThisAVM2Item) || (obj instanceof ClassAVM2Item) || (obj instanceof ScriptAVM2Item)) { slotname = ((ThisAVM2Item) obj).classMultiname; - } else if (obj instanceof ScriptAVM2Item) { - List traits = localData.getScriptInfo().get(((ScriptAVM2Item) obj).scriptIndex).traits.traits; + List traits = localData.getScriptInfo().get(localData.scriptIndex).traits.traits; for (int t = 0; t < traits.size(); t++) { Trait tr = traits.get(t); if (tr instanceof TraitWithSlot) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java index f426df645..e5adb2be4 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.abc.ABC; @@ -83,7 +84,7 @@ public class NewFunctionAVM2Item extends AVM2Item { abc.method_info.get(methodIndex).getReturnTypeStr(writer, abc.constants, fullyQualifiedNames); writer.startBlock(); if (body != null) { - body.convert(new ConvertData(), path + "/inner", ScriptExportMode.AS, isStatic, methodIndex, scriptIndex, classIndex, abc, null, new ScopeStack(), 0, new NulWriter(), fullyQualifiedNames, null, false); + body.convert(new ConvertData(), path + "/inner", ScriptExportMode.AS, isStatic, methodIndex, scriptIndex, classIndex, abc, null, new ScopeStack(scriptIndex), 0, new NulWriter(), fullyQualifiedNames, null, false); body.toString(path + "/inner", ScriptExportMode.AS, abc, null, writer, fullyQualifiedNames); } writer.endBlock(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java index 6009d4540..ac1bb0912 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ScriptAVM2Item.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 69bb4298b..e225271c1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -406,11 +406,11 @@ public final class MethodBody implements Cloneable { return body; } - public String toSource() { + public String toSource(int scriptIndex) { ConvertData convertData = new ConvertData(); convertData.deobfuscationMode = 0; try { - convert(convertData, "", ScriptExportMode.AS, false, method_info, 0, 0, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + convert(convertData, "", ScriptExportMode.AS, false, method_info, 0, 0, abc, null, new ScopeStack(scriptIndex), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false); writer.indent().indent().indent(); toString("", ScriptExportMode.AS, abc, null, writer, new ArrayList<>()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java index 81ed9c4b1..b33b41d10 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.types.traits; import com.jpexs.decompiler.flash.abc.ABC; @@ -223,7 +224,7 @@ public class TraitClass extends Trait implements TraitWithSlot { writer.mark(); List ts = new ArrayList<>(); ts.add(classInfo.static_traits); - abc.bodies.get(bodyIndex).convert(convertData, path +/*packageName +*/ "/" + instanceInfoName + ".staticinitializer", exportMode, true, classInfo.cinit_index, scriptIndex, class_info, abc, this, new ScopeStack(), GraphTextWriter.TRAIT_CLASS_INITIALIZER, writer, fullyQualifiedNames, ts, true); + abc.bodies.get(bodyIndex).convert(convertData, path +/*packageName +*/ "/" + instanceInfoName + ".staticinitializer", exportMode, true, classInfo.cinit_index, scriptIndex, class_info, abc, this, new ScopeStack(scriptIndex), GraphTextWriter.TRAIT_CLASS_INITIALIZER, writer, fullyQualifiedNames, ts, true); classInitializerIsEmpty = !writer.getMark(); } @@ -233,7 +234,7 @@ public class TraitClass extends Trait implements TraitWithSlot { if (bodyIndex != -1) { List ts = new ArrayList<>(); ts.add(instanceInfo.instance_traits); - abc.bodies.get(bodyIndex).convert(convertData, path +/*packageName +*/ "/" + instanceInfoName + ".initializer", exportMode, false, instanceInfo.iinit_index, scriptIndex, class_info, abc, this, new ScopeStack(), GraphTextWriter.TRAIT_INSTANCE_INITIALIZER, writer, fullyQualifiedNames, ts, true); + abc.bodies.get(bodyIndex).convert(convertData, path +/*packageName +*/ "/" + instanceInfoName + ".initializer", exportMode, false, instanceInfo.iinit_index, scriptIndex, class_info, abc, this, new ScopeStack(scriptIndex), GraphTextWriter.TRAIT_INSTANCE_INITIALIZER, writer, fullyQualifiedNames, ts, true); } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java index c666fbda2..61e88fce3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.types.traits; import com.jpexs.decompiler.flash.abc.ABC; @@ -104,7 +105,7 @@ public class TraitFunction extends Trait implements TraitWithSlot { convertHeader(parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel); int bodyIndex = abc.findBodyIndex(method_info); if (bodyIndex != -1) { - abc.bodies.get(bodyIndex).convert(convertData, path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames, false, true), exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, new ScopeStack(), 0, writer, fullyQualifiedNames, null, true); + abc.bodies.get(bodyIndex).convert(convertData, path + "." + abc.constants.getMultiname(name_index).getName(abc.constants, fullyQualifiedNames, false, true), exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, new ScopeStack(classIndex), 0, writer, fullyQualifiedNames, null, true); } writer.endMethod(); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java index 03191f51a..dfd54a65f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.abc.types.traits; import com.jpexs.decompiler.flash.abc.ABC; @@ -115,7 +116,7 @@ public class TraitMethodGetterSetter extends Trait { if (exportMode != ScriptExportMode.AS_METHOD_STUBS) { if (!(classIndex != -1 && abc.instance_info.get(classIndex).isInterface() || bodyIndex == -1)) { if (bodyIndex != -1) { - abc.bodies.get(bodyIndex).convert(convertData, path, exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, new ScopeStack(), 0, writer, fullyQualifiedNames, null, true); + abc.bodies.get(bodyIndex).convert(convertData, path, exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, new ScopeStack(scriptIndex), 0, writer, fullyQualifiedNames, null, true); } } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java index 2ebb56e7a..3a007f1f2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/script/AS3ScriptExporter.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.exporters.script; import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler; @@ -105,7 +106,7 @@ public class AS3ScriptExporter { StringBuilder out = new StringBuilder(); int method = t.method_info; try { - pack.abc.findBody(method).convert(new ConvertData(), "??", ScriptExportMode.AS, false, method, pack.scriptIndex, cindex, pack.abc, t, new ScopeStack(), 0/*?*/, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + pack.abc.findBody(method).convert(new ConvertData(), "??", ScriptExportMode.AS, false, method, pack.scriptIndex, cindex, pack.abc, t, new ScopeStack(pack.scriptIndex), 0/*?*/, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); List ci = pack.abc.findBody(method).convertedItems; if (!ci.isEmpty()) { @@ -178,7 +179,7 @@ public class AS3ScriptExporter { StringBuilder out = new StringBuilder(); int method = t.method_info; try { - pack.abc.findBody(method).convert(new ConvertData(), "??", ScriptExportMode.AS, false, method, pack.scriptIndex, cindex, pack.abc, t, new ScopeStack(), 0/*?*/, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + pack.abc.findBody(method).convert(new ConvertData(), "??", ScriptExportMode.AS, false, method, pack.scriptIndex, cindex, pack.abc, t, new ScopeStack(pack.scriptIndex), 0/*?*/, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); List ci = pack.abc.findBody(method).convertedItems; if (!ci.isEmpty() && (ci.get(0) instanceof DeclarationAVM2Item)) { @@ -269,7 +270,7 @@ public class AS3ScriptExporter { int iinit = pack.abc.instance_info.get(cindex).iinit_index; try { - pack.abc.findBody(iinit).convert(new ConvertData(), "??", ScriptExportMode.AS, false, iinit, pack.scriptIndex, cindex, pack.abc, t, new ScopeStack(), 0/*?*/, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + pack.abc.findBody(iinit).convert(new ConvertData(), "??", ScriptExportMode.AS, false, iinit, pack.scriptIndex, cindex, pack.abc, t, new ScopeStack(pack.scriptIndex), 0/*?*/, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); List iinitBody = pack.abc.findBody(iinit).convertedItems; for (GraphTargetItem it : iinitBody) { if (it instanceof InitPropertyAVM2Item) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java index f0f6390c1..a7b3dcca3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/xfl/XFLConverter.java @@ -2455,7 +2455,7 @@ public class XFLConverter { MethodBody constructorBody = abc.findBody(constructorMethodIndex); try { if (constructorBody.convertedItems == null) { - constructorBody.convert(new ConvertData(), "??", ScriptExportMode.AS, true, constructorMethodIndex, pack.scriptIndex, classIndex, abc, null, new ScopeStack(), GraphTextWriter.TRAIT_INSTANCE_INITIALIZER, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + constructorBody.convert(new ConvertData(), "??", ScriptExportMode.AS, true, constructorMethodIndex, pack.scriptIndex, classIndex, abc, null, new ScopeStack(pack.scriptIndex), GraphTextWriter.TRAIT_INSTANCE_INITIALIZER, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); } Map frameToTraitMultiname = new HashMap<>(); @@ -2518,7 +2518,7 @@ public class XFLConverter { MethodBody frameBody = abc.findBody(methodIndex); StringBuilder scriptBuilder = new StringBuilder(); - frameBody.convert(new ConvertData(), "??", ScriptExportMode.AS, false, methodIndex, pack.scriptIndex, classIndex, abc, methodTrait, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); + frameBody.convert(new ConvertData(), "??", ScriptExportMode.AS, false, methodIndex, pack.scriptIndex, classIndex, abc, methodTrait, new ScopeStack(pack.scriptIndex), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); StringBuilderTextWriter writer = new StringBuilderTextWriter(Configuration.getCodeFormatting(), scriptBuilder); frameBody.toString("??", ScriptExportMode.AS, abc, methodTrait, writer, new ArrayList<>()); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index 7ac8de000..59d735799 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -724,6 +724,7 @@ public class Graph { lastUsage.get(labelName).labelName = null; } } + expandGotos(ret); processIfs(ret); finalProcessStack(stack, ret, path); finalProcessAll(ret, 0, new FinalProcessLocalData(loops), path); @@ -1203,16 +1204,6 @@ public class Graph { } protected void finalProcessAfter(List list, int level, FinalProcessLocalData localData, String path) { - if (!list.isEmpty() && (list.get(list.size() - 1) instanceof GotoItem)) { - GotoItem gi = (GotoItem) list.get(list.size() - 1); - if (gi.targetCommands != null) { - list.remove(gi); - if (gi.labelName != null) { - list.add(new LabelItem(null, gi.lineStartItem, gi.labelName)); - } - list.addAll(gi.targetCommands); - } - } if (list.size() >= 2) { if (list.get(list.size() - 1) instanceof ExitItem) { ExitItem e = (ExitItem) list.get(list.size() - 1); @@ -1306,6 +1297,28 @@ public class Graph { } } + private void expandGotos(List list) { + if (!list.isEmpty() && (list.get(list.size() - 1) instanceof GotoItem)) { + GotoItem gi = (GotoItem) list.get(list.size() - 1); + if (gi.targetCommands != null) { + list.remove(gi); + if (gi.labelName != null) { + list.add(new LabelItem(null, gi.lineStartItem, gi.labelName)); + } + list.addAll(gi.targetCommands); + } + } + for (int i = 0; i < list.size(); i++) { + GraphTargetItem item = list.get(i); + if (item instanceof Block) { + List> subs = ((Block) item).getSubs(); + for (List sub : subs) { + expandGotos(sub); + } + } + } + } + private void processIfs(List list) { for (int i = 0; i < list.size(); i++) { GraphTargetItem item = list.get(i); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/ScopeStack.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/ScopeStack.java index 13b2b16af..c7f8bc4a0 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/ScopeStack.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/ScopeStack.java @@ -12,9 +12,12 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.graph; +import com.jpexs.decompiler.flash.abc.avm2.model.ScriptAVM2Item; + /** * * @author JPEXS @@ -28,4 +31,9 @@ public class ScopeStack extends TranslateStack { public ScopeStack() { this(true); } + + public ScopeStack(int scriptIndex) { + this(true); + //push(new ScriptAVM2Item(scriptIndex)); + } } diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java index ca6ab0c19..ecb272403 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java @@ -12,7 +12,8 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash; import com.jpexs.decompiler.flash.abc.ABC; @@ -24,16 +25,22 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.helpers.CodeFormatting; import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter; import com.jpexs.decompiler.flash.helpers.NulWriter; +import com.jpexs.decompiler.flash.tags.ABCContainerTag; import com.jpexs.decompiler.flash.tags.DoABC2Tag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.decompiler.graph.ScopeStack; import java.io.BufferedInputStream; +import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; @@ -49,25 +56,12 @@ public class ActionScript3Test extends ActionScriptTestBase { private SWF swf; - private int clsIndex; - - private ABC abc; @BeforeClass public void init() throws IOException, InterruptedException { //Main.initLogging(false); - swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as3/as3.swf")), false); - DoABC2Tag tag = null; - for (Tag t : swf.getTags()) { - if (t instanceof DoABC2Tag) { - tag = (DoABC2Tag) t; - break; - } - } - assertNotNull(tag); - clsIndex = tag.getABC().findClassByName(new DottedChain(new String[]{"classes", "Test"}, "")); - assertTrue(clsIndex > -1); - this.abc = tag.getABC(); + swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/flashdevelop/bin/flashdevelop.swf")), false); + Configuration.autoDeobfuscate.set(false); Configuration.simplifyExpressions.set(false); @@ -77,15 +71,42 @@ public class ActionScript3Test extends ActionScriptTestBase { } private void decompileMethod(String methodName, String expectedResult, boolean isStatic) { - int bodyIndex = abc.findMethodBodyByName(clsIndex, methodName); + String className = methodName.substring(0, 1).toUpperCase() + methodName.substring(1); + + int clsIndex = -1; + int scriptIndex = -1; + + ABC abc = null; + List abcs = new ArrayList<>(); + for (ABCContainerTag abcTag : swf.getAbcList()) { + abcs.add(abcTag.getABC()); + } + ScriptPack scriptPack = null; + for (ABC a : abcs) { + scriptPack = a.findScriptPackByPath("tests." + className, abcs); + if (scriptPack != null) { + break; + } + } + assertNotNull(scriptPack); + abc = scriptPack.abc; + scriptIndex = scriptPack.scriptIndex; + + clsIndex = abc.findClassByName(new DottedChain(new String[]{"tests", className}, "")); + + assertTrue(clsIndex > -1); + assertTrue(scriptIndex > -1); + + int bodyIndex = abc.findMethodBodyByName(clsIndex, "run"); + assertTrue(bodyIndex > -1); HighlightedTextWriter writer; try { List ts = new ArrayList<>(); ts.add(abc.instance_info.get(clsIndex).instance_traits); - abc.bodies.get(bodyIndex).convert(new ConvertData(), methodName, ScriptExportMode.AS, isStatic, -1/*FIX?*/, -1/*FIX?*/, clsIndex, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), ts, true); + abc.bodies.get(bodyIndex).convert(new ConvertData(), "run", ScriptExportMode.AS, isStatic, abc.bodies.get(bodyIndex).method_info, scriptIndex, clsIndex, abc, null, new ScopeStack(scriptIndex), 0, new NulWriter(), new ArrayList<>(), ts, true); writer = new HighlightedTextWriter(new CodeFormatting(), false); - abc.bodies.get(bodyIndex).toString(methodName, ScriptExportMode.AS, abc, null, writer, new ArrayList<>()); + abc.bodies.get(bodyIndex).toString("run", ScriptExportMode.AS, abc, null, writer, new ArrayList<>()); } catch (InterruptedException ex) { fail(); return; @@ -96,12 +117,24 @@ public class ActionScript3Test extends ActionScriptTestBase { } private void decompileScriptPack(String path, String expectedResult) { - ScriptPack scriptPack = abc.findScriptPackByPath(path, Arrays.asList(abc)); - assertTrue(scriptPack != null); + + DoABC2Tag tag = null; + ABC abc = null; + ScriptPack scriptPack = null; + for (Tag t : swf.getTags()) { + if (t instanceof DoABC2Tag) { + tag = (DoABC2Tag) t; + abc = tag.getABC(); + scriptPack = abc.findScriptPackByPath(path, Arrays.asList(abc)); + if (scriptPack != null) { + break; + } + } + } + assertNotNull(abc); + assertNotNull(scriptPack); HighlightedTextWriter writer = null; try { - List ts = new ArrayList<>(); - ts.add(abc.instance_info.get(clsIndex).instance_traits); writer = new HighlightedTextWriter(new CodeFormatting(), false); scriptPack.toSource(writer, abc.script_info.get(scriptPack.scriptIndex).traits.traits, new ConvertData(), ScriptExportMode.AS, false); } catch (InterruptedException ex) { @@ -967,9 +1000,9 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testMyPackage1TestClass() { - decompileScriptPack("classes.mypackage1.TestClass", "package classes.mypackage1\n" + decompileScriptPack("tests_classes.mypackage1.TestClass", "package tests_classes.mypackage1\n" + "{\n" - + " public class TestClass implements classes.mypackage1.TestInterface\n" + + " public class TestClass implements tests_classes.mypackage1.TestInterface\n" + " {\n" + " \n" + " public function TestClass()\n" @@ -985,18 +1018,18 @@ public class ActionScript3Test extends ActionScriptTestBase { + " \n" + " public function testMethod1() : void\n" + " {\n" - + " var a:classes.mypackage1.TestInterface = this;\n" + + " var a:tests_classes.mypackage1.TestInterface = this;\n" + " a.testMethod1();\n" - + " var b:classes.mypackage2.TestInterface = this;\n" - + " b = new classes.mypackage2.TestClass();\n" + + " var b:tests_classes.mypackage2.TestInterface = this;\n" + + " b = new tests_classes.mypackage2.TestClass();\n" + " }\n" + " \n" + " public function testMethod2() : void\n" + " {\n" - + " var a:classes.mypackage1.TestInterface = this;\n" + + " var a:tests_classes.mypackage1.TestInterface = this;\n" + " a.testMethod1();\n" - + " var b:classes.mypackage2.TestInterface = this;\n" - + " b = new classes.mypackage2.TestClass();\n" + + " var b:tests_classes.mypackage2.TestInterface = this;\n" + + " b = new tests_classes.mypackage2.TestClass();\n" + " }\n" + " }\n" + "}"); @@ -1004,7 +1037,7 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testMyPackage1TestClass2() { - decompileScriptPack("classes.mypackage1.TestClass2", "package classes.mypackage1\n" + decompileScriptPack("tests_classes.mypackage1.TestClass2", "package tests_classes.mypackage1\n" + "{\n" + " public class TestClass2\n" + " {\n" @@ -1014,14 +1047,14 @@ public class ActionScript3Test extends ActionScriptTestBase { + " super();\n" + " }\n" + " \n" - + " public function testCall() : *\n" + + " public function testCall() : String\n" + " {\n" - + " var a:classes.mypackage1.TestClass = null;\n" - + " var b:classes.mypackage2.TestClass = null;\n" - + " var c:classes.mypackage3.TestClass = null;\n" - + " a = new classes.mypackage1.TestClass();\n" - + " b = new classes.mypackage2.TestClass();\n" - + " c = new classes.mypackage3.TestClass();\n" + + " var a:tests_classes.mypackage1.TestClass = null;\n" + + " var b:tests_classes.mypackage2.TestClass = null;\n" + + " var c:tests_classes.mypackage3.TestClass = null;\n" + + " a = new tests_classes.mypackage1.TestClass();\n" + + " b = new tests_classes.mypackage2.TestClass();\n" + + " c = new tests_classes.mypackage3.TestClass();\n" + " var res:String = a.testCall() + b.testCall() + c.testCall() + this.testCall2() + myNamespace::testCall3();\n" + " trace(res);\n" + " return res;\n" @@ -1047,9 +1080,9 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testMyPackage1TestInterface() { - decompileScriptPack("classes.mypackage1.TestInterface", "package classes.mypackage1\n" + decompileScriptPack("tests_classes.mypackage1.TestInterface", "package tests_classes.mypackage1\n" + "{\n" - + " public interface TestInterface extends classes.mypackage2.TestInterface\n" + + " public interface TestInterface extends tests_classes.mypackage2.TestInterface\n" + " {\n" + " \n" + " function testMethod1() : void;\n" @@ -1059,7 +1092,7 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testMyPackage1MyNamespace() { - decompileScriptPack("classes.mypackage1.myNamespace", "package classes.mypackage1\n" + decompileScriptPack("tests_classes.mypackage1.myNamespace", "package tests_classes.mypackage1\n" + "{\n" + " public namespace myNamespace = \"https://www.free-decompiler.com/flash/test/namespace\";\n" + "}"); @@ -1067,7 +1100,7 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testMyPackage2TestClass() { - decompileScriptPack("classes.mypackage2.TestClass", "package classes.mypackage2\n" + decompileScriptPack("tests_classes.mypackage2.TestClass", "package tests_classes.mypackage2\n" + "{\n" + " public class TestClass implements TestInterface\n" + " {\n" @@ -1092,7 +1125,7 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testMyPackage2TestInterface() { - decompileScriptPack("classes.mypackage2.TestInterface", "package classes.mypackage2\n" + decompileScriptPack("tests_classes.mypackage2.TestInterface", "package tests_classes.mypackage2\n" + "{\n" + " public interface TestInterface\n" + " {\n" @@ -1104,7 +1137,7 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testMyPackage3TestClass() { - decompileScriptPack("classes.mypackage3.TestClass", "package classes.mypackage3\n" + decompileScriptPack("tests_classes.mypackage3.TestClass", "package tests_classes.mypackage3\n" + "{\n" + " public class TestClass\n" + " {\n" @@ -1126,8 +1159,25 @@ public class ActionScript3Test extends ActionScriptTestBase { @Test public void testOptionalParameters() { String methodName = "testOptionalParameters"; - int methodInfo = abc.findMethodInfoByName(clsIndex, methodName); - int bodyIndex = abc.findMethodBodyByName(clsIndex, methodName); + String className = methodName.substring(0, 1).toUpperCase() + methodName.substring(1); + + int clsIndex = -1; + DoABC2Tag tag = null; + ABC abc = null; + for (Tag t : swf.getTags()) { + if (t instanceof DoABC2Tag) { + tag = (DoABC2Tag) t; + abc = tag.getABC(); + clsIndex = abc.findClassByName(new DottedChain(new String[]{"tests", className}, "")); + if (clsIndex > -1) { + break; + } + } + } + assertTrue(clsIndex > -1); + + int methodInfo = abc.findMethodInfoByName(clsIndex, "run"); + int bodyIndex = abc.findMethodBodyByName(clsIndex, "run"); assertTrue(methodInfo > -1); assertTrue(bodyIndex > -1); HighlightedTextWriter writer = new HighlightedTextWriter(new CodeFormatting(), false); diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java index 9d003641d..cc4aa0062 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java @@ -12,11 +12,13 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library. */ + * License along with this library. + */ package com.jpexs.decompiler.flash.generators; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.abc.ABC; +import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.abc.types.ConvertData; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.abc.types.traits.Trait; @@ -46,54 +48,57 @@ public class AS3Generator { public static void main(String[] args) throws Exception { Configuration.autoDeobfuscate.set(false); - SWF swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as3/as3.swf")), false); + SWF swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/flashdevelop/bin/flashdevelop.swf")), false); DoABC2Tag tag = null; - for (Tag t : swf.getTags()) { - if (t instanceof DoABC2Tag) { - tag = (DoABC2Tag) t; - break; - } - } - if (tag == null) { - System.err.println("No ABC found"); - return; - } - ABC abc = tag.getABC(); - int classId = abc.findClassByName("classes.Test"); + List scriptPacks = swf.getAS3Packs(); + StringBuilder s = new StringBuilder(); - for (Trait t : abc.instance_info.get(classId).instance_traits.traits) { - if (t instanceof TraitMethodGetterSetter) { - String name = t.getName(abc).getName(abc.constants, null, true, true); - if (name.startsWith("test")) { - s.append("@Test\r\npublic void "); - s.append(name); - s.append("(){\r\ndecompileMethod(\""); - s.append(name); - s.append("\", "); - HighlightedTextWriter src = new HighlightedTextWriter(new CodeFormatting(), false); - MethodBody b = abc.findBody(((TraitMethodGetterSetter) t).method_info); - List ts = new ArrayList<>(); - ts.add(abc.instance_info.get(classId).instance_traits); - b.convert(new ConvertData(), "", ScriptExportMode.AS, false, -1/*FIX?*/, -1/*FIX?*/, classId, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), ts, true); - b.toString("", ScriptExportMode.AS, abc, null, src, new ArrayList<>()); - String[] srcs = src.toString().split("[\r\n]+"); - for (int i = 0; i < srcs.length; i++) { - String ss = srcs[i]; - s.append("\""); - s.append(ss.trim().replace("\\", "\\\\").replace("\"", "\\\"")); - s.append("\\r\\n\""); - if (i < srcs.length - 1) { - s.append("+"); + for (ScriptPack pack : scriptPacks) { + ABC abc = pack.abc; + if (pack.getClassPath().packageStr.toRawString().equals("tests")) { + abc.findClassByName(pack.getClassPath().toRawString()); + + int classId = abc.findClassByName(pack.getClassPath().toRawString()); + + for (Trait t : abc.instance_info.get(classId).instance_traits.traits) { + if (t instanceof TraitMethodGetterSetter) { + String name = t.getName(abc).getName(abc.constants, null, true, true); + String clsName = pack.getClassPath().className; + String lower = clsName.substring(0, 1).toLowerCase() + clsName.substring(1); + if (name.equals("run")) { + s.append("@Test\r\npublic void "); + s.append(name); + s.append("(){\r\ndecompileMethod(\""); + s.append(lower); + s.append("\", "); + HighlightedTextWriter src = new HighlightedTextWriter(new CodeFormatting(), false); + MethodBody b = abc.findBody(((TraitMethodGetterSetter) t).method_info); + List ts = new ArrayList<>(); + ts.add(abc.instance_info.get(classId).instance_traits); + b.convert(new ConvertData(), "", ScriptExportMode.AS, false, ((TraitMethodGetterSetter) t).method_info, pack.scriptIndex, classId, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), ts, true); + b.toString("", ScriptExportMode.AS, abc, null, src, new ArrayList<>()); + String[] srcs = src.toString().split("[\r\n]+"); + for (int i = 0; i < srcs.length; i++) { + String ss = srcs[i]; + s.append("\""); + s.append(ss.trim().replace("\\", "\\\\").replace("\"", "\\\"")); + s.append("\\r\\n\""); + if (i < srcs.length - 1) { + s.append("+"); + } + s.append("\r\n"); + } + s.append(", false);"); + s.append("}"); } - s.append("\r\n"); } - s.append(", false);"); - s.append("}"); } } - try (PrintWriter pw = new PrintWriter("as3_teststub.java")) { - pw.println(s.toString()); - } } + + try (PrintWriter pw = new PrintWriter("as3_teststub.java")) { + pw.println(s.toString()); + } + System.exit(0); } } diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/expressInstall.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/expressInstall.swf new file mode 100644 index 0000000000000000000000000000000000000000..86958bf3a726d6e946e36fb5d34aaf315c9f0b24 GIT binary patch literal 773 zcmV+g1N!_!S5pQ-1pokeoP|`)Pt-sZ|8;lSEwI4K*P@gUAu&n}HSvZZ1PFwL1zA83 z#=~qoK%v_y{QdanFT+{w@Z$&6T61KWAk)|Bv_e13 zkzQ;4o&u7j&L%&Rbo@gZgY7bt`wO<^ArQVUco)Icx1Iz$4zdt3Vd!_J~za6aTSF^ zv*wWj_qQlBDW*%Qh0S3w+b%KVVDs71dTF1GvFIK}IVLX)XduinxNUQ@0WC30>N}o! zfs~oyyJbqvCJncY%}OA6838v!-x3v2KKE$REi=oZhS;l>^CCrO`0sUmoQT`uOOu;q$6 z<1wpLl5wyqJ7`kX;<6{Fxuz}PE2`~CqyDMTstKsdnp_h_xh7Y--z9J#Qch{r3^Ix| zY?;Y7Ii^WhkbL|$fhUn|CW@qLyV8B;f9`SK)?zc-Ru5WDQM`J@cCFfi%&#QSu{?Cr z+dO47+WT0El2ODo)ND#oJJ!}4Kqmp6SAi}9x(K+2g<_uQx;mdgu9>dfO#WmHmO~fB zwl@V6VL+ECF##orl&8!NIZCpil=6m7F5}+VAx1_(hoWP3OC?`ddg2}8P?yWZU&#pU zyAA|S`>(kLz(c%xfPHqz0>igFF-4=}MthU|rRVb?Scz+2sQcc%_lSyYh1whUsV`!p z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JcPCS3?-V(!AK8WWB z9bD*$B5-aMqr^%`ZBWXAm@wVMO3yc>v@PAlMwDVnm!(55`y3^vGnl%MCW64C>oM`r zSTaaF)IC<=JF?N%U;X!G6?`-u?Zoek-{p(t_a#OFU<)-;> zJn)CaN~b$lLN5IfD=&X%A#jLU@V)h^9D;4(6NV3Ez#MhKHhfUAD-JObo+zYUnDv8< z)y4B7aeF$I6N%e3=;?*#11a0FP-n18Q+PUwAP6{uxq6gxcECzq5HUv-H=|gv$XK)) zHGCMbaO*>?G>l^e#~6+yEStlWK?I#JTf^}bt8<30&X@`Y%aYav(LAABD9tpkpac6% zyD5sTOrW4k^JNllS+iK{a^5}xv`!b>`3HA3#G%qEj4kFK+%?ENWWHu%)7HmrZZ~9J zzd_M&i24m?1_F@) literal 0 HcmV?d00001 diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/index.html b/libsrc/ffdec_lib/testdata/flashdevelop/bin/index.html new file mode 100644 index 000000000..54c4aea95 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/bin/index.html @@ -0,0 +1,40 @@ + + + + + flashdevelop + + + + + + + +
+

flashdevelop

+

Get Adobe Flash player

+
+ + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/js/swfobject.js b/libsrc/ffdec_lib/testdata/flashdevelop/bin/js/swfobject.js new file mode 100644 index 000000000..8eafe9dd8 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/bin/js/swfobject.js @@ -0,0 +1,4 @@ +/* SWFObject v2.2 + is released under the MIT License +*/ +var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old new file mode 100644 index 000000000..758709093 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old @@ -0,0 +1,48 @@ + + + + + 25.0 + false + true + + + CONFIG::debug + true + + + CONFIG::release + false + + + CONFIG::timeStamp + '18.01.2021' + + + CONFIG::air + false + + + CONFIG::mobile + false + + + CONFIG::desktop + false + + true + + C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src + C:\Program Files (x86)\FlashDevelop\Library\AS3\classes + + + + C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src\Main.as + + #FFFFFF + 30 + + 800 + 600 + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml new file mode 100644 index 000000000..758709093 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml @@ -0,0 +1,48 @@ + + + + + 25.0 + false + true + + + CONFIG::debug + true + + + CONFIG::release + false + + + CONFIG::timeStamp + '18.01.2021' + + + CONFIG::air + false + + + CONFIG::mobile + false + + + CONFIG::desktop + false + + true + + C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src + C:\Program Files (x86)\FlashDevelop\Library\AS3\classes + + + + C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src\Main.as + + #FFFFFF + 30 + + 800 + 600 + + \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/Main.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/Main.as new file mode 100644 index 000000000..6aba4e6c7 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/Main.as @@ -0,0 +1,91 @@ +package +{ + import flash.display.Sprite; + import flash.events.Event; + import tests.*; + import tests_classes.mypackage1.SetupMyPackage1; + import tests_classes.mypackage2.SetupMyPackage2; + import tests_classes.mypackage3.SetupMyPackage3; + + /** + * ... + * @author JPEXS + */ + public class Main extends Sprite + { + TestArguments; + TestCatchFinally; + TestChain2; + TestChainedAssignments; + TestComplexExpressions; + TestContinueLevels; + TestDecl2; + TestDeclarations; + TestDefaultNotLastGrouped; + TestDoWhile; + TestDoWhile2; + TestExpressions; + TestFinallyZeroJump; + TestFor; + TestForBreak; + TestForContinue; + TestForEach; + TestForEachObjectArray; + TestForEachObjectAttribute; + TestForIn; + TestHello; + TestIf; + TestIfElse; + TestInc2; + TestIncDec; + TestInlineFunctions; + TestInnerFunctions; + TestInnerIf; + TestInnerTry; + TestLogicalComputing; + TestManualConvert; + TestMissingDefault; + TestMultipleCondition; + TestNamedAnonFunctions; + TestNames; + TestOptionalParameters; + TestParamNames; + TestParamsCount; + TestPrecedence; + TestPrecedenceX; + TestProperty; + TestRegExp; + TestRest; + TestStringConcat; + TestStrings; + TestSwitch; + TestSwitchDefault; + TestTernarOperator; + TestTry; + TestTryReturn; + TestVector; + TestVector2; + TestWhileAnd; + TestWhileContinue; + TestWhileTry; + TestWhileTry2; + + SetupMyPackage1; + SetupMyPackage2; + SetupMyPackage3; + + public function Main() + { + if (stage) init(); + else addEventListener(Event.ADDED_TO_STAGE, init); + } + + private function init(e:Event = null):void + { + removeEventListener(Event.ADDED_TO_STAGE, init); + // entry point + } + + } + +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestArguments.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestArguments.as new file mode 100644 index 000000000..beab344f2 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestArguments.as @@ -0,0 +1,11 @@ +package tests +{ + + public class TestArguments + { + public function run():* + { + return arguments[0]; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestCatchFinally.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestCatchFinally.as new file mode 100644 index 000000000..33ea55064 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestCatchFinally.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestCatchFinally + { + public function run():* + { + var a:* = 5; + try + { + a = 9; + trace("intry"); + } + catch (e:*) + { + trace("incatch"); + } + finally + { + trace("infinally"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChain2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChain2.as new file mode 100644 index 000000000..8aa009c95 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChain2.as @@ -0,0 +1,30 @@ +package tests +{ + + public class TestChain2 + { + public function run():* + { + var g:Array = null; + var h:Boolean = false; + var extraLine:Boolean = false; + var r:int = 7; + var t:int = 0; + t = this.getInt(); + if (t + 1 < g.length) + { + t++; + h = true; + } + if (t >= 0) + { + trace("ch"); + } + } + + private function getInt():int + { + return 5; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChainedAssignments.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChainedAssignments.as new file mode 100644 index 000000000..3972c2cf8 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChainedAssignments.as @@ -0,0 +1,49 @@ +package tests +{ + + public class TestChainedAssignments + { + public function run():* + { + var a:int = 0; + var b:int = 0; + var c:int = 0; + var d:int = 0; + d = c = b = a = 5; + var e:TestClass2 = TestClass2.createMe("test"); + e.attrib1 = e.attrib2 = e.attrib3 = this.getCounter(); + this.traceIt(e.toString()); + } + + private function getCounter() : int + { + return 5; + } + + private function traceIt(s:String) : void + { + trace(s); + } + } +} + +class TestClass2 { + public var attrib1:int; + public var attrib2:int; + public var attrib3:int; + + public function TestClass2(a1:String) + { + trace("Class2 construct"); + } + + public static function createMe(a1:String):TestClass2 + { + return new TestClass2(a1); + } + + public function toString() : String + { + return "tc2"; + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestComplexExpressions.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestComplexExpressions.as new file mode 100644 index 000000000..3aa9aa4f5 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestComplexExpressions.as @@ -0,0 +1,13 @@ +package tests +{ + + public class TestComplexExpressions + { + public function run():* + { + var i:int = 0; + var j:int = 0; + j = i = i + (i = i + i++); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestContinueLevels.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestContinueLevels.as new file mode 100644 index 000000000..bac2f00d2 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestContinueLevels.as @@ -0,0 +1,66 @@ +package tests +{ + + public class TestContinueLevels + { + public function run():* + { + var a:* = 5; + loop123: switch (a) + { + case 57 * a: + trace("fiftyseven multiply a"); + var b:* = 0; + while (b < 50) + { + if (b == 10) + { + break; + } + if (b == 15) + { + break loop123; + } + b = b + 1; + } + break; + case 13: + trace("thirteen"); + case 14: + trace("fourteen"); + break; + case 89: + trace("eightynine"); + break; + default: + trace("default clause"); + } + + loop182: for (var c:* = 0; c < 8; c = c + 1) + { + + loop165: for (var d:* = 0; d < 25; d++) + { + + for (var e:* = 0; e < 50; e++) + { + if (e == 9) + { + break loop165; + } + if (e == 20) + { + continue loop182; + } + if (e == 8) + { + break; + } + break loop182; + } + } + trace("hello"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDecl2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDecl2.as new file mode 100644 index 000000000..637643100 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDecl2.as @@ -0,0 +1,21 @@ +package tests +{ + + public class TestDecl2 + { + public function run():* + { + var k:int = 0; + var i:int = 5; + i = i + 7; + if (i == 5) + { + if (i < 8) + { + k = 6; + } + } + k = 7; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDeclarations.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDeclarations.as new file mode 100644 index 000000000..49f9b5935 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDeclarations.as @@ -0,0 +1,30 @@ +package tests +{ + + public class TestDeclarations + { + public function run():* + { + var vall:* = undefined; + var vstr:String = null; + var vint:int = 0; + var vuint:uint = 0; + var vclass:TestClass1 = null; + var vnumber:Number = NaN; + var vobject:Object = null; + vall = 6; + vstr = "hello"; + vuint = 7; + vint = -4; + vclass = new TestClass1(); + vnumber = 0.5; + vnumber = 6; + vobject = vclass; + } + } +} + +class TestClass1 +{ + +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDefaultNotLastGrouped.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDefaultNotLastGrouped.as new file mode 100644 index 000000000..bdd46d19f --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDefaultNotLastGrouped.as @@ -0,0 +1,23 @@ +package tests +{ + + public class TestDefaultNotLastGrouped + { + public function run():* + { + var k:* = 10; + switch (k) + { + default: + case "six": + trace("def and 6"); + case "five": + trace("def and 6 and 5"); + break; + case "four": + trace("4"); + } + trace("after switch"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile.as new file mode 100644 index 000000000..f57c38689 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile.as @@ -0,0 +1,17 @@ +package tests +{ + + public class TestDoWhile + { + public function run():* + { + var a:* = 8; + do + { + trace("a=" + a); + a++; + } while (a < 20); + + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile2.as new file mode 100644 index 000000000..d037e6bc3 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile2.as @@ -0,0 +1,26 @@ +package tests +{ + + public class TestDoWhile2 + { + public function run():* + { + var k:int = 5; + do + { + k++; + if (k == 7) + { + k = 5 * k; + } + else + { + k = 5 - k; + } + k--; + } while (k < 9); + + return 2; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestExpressions.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestExpressions.as new file mode 100644 index 000000000..a0d020122 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestExpressions.as @@ -0,0 +1,27 @@ +package tests +{ + + public class TestExpressions + { + public function run():* + { + var arr:Array = null; + var i:int = 5; + var j:int = 5; + if ((i = i = i / 2) == 1 || i == 2) + { + arguments.concat(i); + } + else if (i == 0) + { + i = j++; + } + else + { + arr[0](); + } + + return i == 0; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFinallyZeroJump.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFinallyZeroJump.as new file mode 100644 index 000000000..8e0335183 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFinallyZeroJump.as @@ -0,0 +1,27 @@ +package tests +{ + + public class TestFinallyZeroJump + { + public function run(param1:String) : String + { + var str:String = param1; + try + { + } + catch (e:Error) + { + trace("error is :" + e.message); + } + finally + { + trace("hi "); + if (5 == 4) + { + return str; + } + return "hu" + str; + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFor.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFor.as new file mode 100644 index 000000000..892a2ae91 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFor.as @@ -0,0 +1,14 @@ +package tests +{ + + public class TestFor + { + public function run():* + { + for (var a:* = 0; a < 10; a++) + { + trace("a=" + a); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForBreak.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForBreak.as new file mode 100644 index 000000000..baabf2e93 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForBreak.as @@ -0,0 +1,18 @@ +package tests +{ + + public class TestForBreak + { + public function run():* + { + for (var a:* = 0; a < 10; a++) + { + if (a == 5) + { + break; + } + trace("hello:" + a); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForContinue.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForContinue.as new file mode 100644 index 000000000..22efe805f --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForContinue.as @@ -0,0 +1,33 @@ +package tests +{ + + public class TestForContinue + { + public function run():* + { + for (var a:* = 0; a < 10; a = a + 1) + { + if (a == 9) + { + if (a == 5) + { + trace("part1"); + continue; + } + trace("a=" + a); + if (a == 7) + { + trace("part2"); + continue; + } + trace("part3"); + } + else + { + trace("part4"); + } + trace("part5"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEach.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEach.as new file mode 100644 index 000000000..3facc63c9 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEach.as @@ -0,0 +1,20 @@ +package tests +{ + + public class TestForEach + { + public function run():* + { + var list:Array = null; + var item:* = undefined; + list = new Array(); + list[0] = "first"; + list[1] = "second"; + list[2] = "third"; + for each (item in list) + { + trace("item #" + item); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectArray.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectArray.as new file mode 100644 index 000000000..f37f31420 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectArray.as @@ -0,0 +1,22 @@ +package tests +{ + + public class TestForEachObjectArray + { + public function run():* + { + var list:Array = null; + var test:Array = null; + list = new Array(); + list[0] = "first"; + list[1] = "second"; + list[2] = "third"; + test = new Array(); + test[0] = 0; + for each (test[0] in list) + { + trace("item #" + test[0]); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectAttribute.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectAttribute.as new file mode 100644 index 000000000..2f900bd62 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectAttribute.as @@ -0,0 +1,21 @@ +package tests +{ + + public class TestForEachObjectAttribute + { + private var testPriv:int = 5; + + public function run():* + { + var list:Array = null; + list = new Array(); + list[0] = "first"; + list[1] = "second"; + list[2] = "third"; + for each (this.testPriv in list) + { + trace("item #" + this.testPriv); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForIn.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForIn.as new file mode 100644 index 000000000..f73f0f6b4 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForIn.as @@ -0,0 +1,21 @@ +package tests +{ + import flash.utils.Dictionary; + + public class TestForIn + { + public function run():* + { + var dic:Dictionary = null; + var item:* = null; + for (item in dic) + { + trace(item); + } + for each (item in dic) + { + trace(item); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestHello.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestHello.as new file mode 100644 index 000000000..ee5573eff --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestHello.as @@ -0,0 +1,11 @@ +package tests +{ + + public class TestHello + { + public function run():* + { + trace("hello"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIf.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIf.as new file mode 100644 index 000000000..a60f2f66d --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIf.as @@ -0,0 +1,15 @@ +package tests +{ + + public class TestIf + { + public function run():* + { + var a:* = 5; + if (a == 7) + { + trace("onTrue"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIfElse.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIfElse.as new file mode 100644 index 000000000..01f74c297 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIfElse.as @@ -0,0 +1,19 @@ +package tests +{ + + public class TestIfElse + { + public function run():* + { + var a:* = 5; + if (a == 7) + { + trace("onTrue"); + } + else + { + trace("onFalse"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInc2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInc2.as new file mode 100644 index 000000000..9a6a08b91 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInc2.as @@ -0,0 +1,23 @@ +package tests +{ + + public class TestInc2 + { + public function run():* + { + var a:* = [1]; + a[this.getInt()]++; + var d:* = a[this.getInt()]++; + var e:* = ++a[this.getInt()]; + var b:* = 1; + b++; + var c:* = 1; + b = c++; + } + + private function getInt():int + { + return 5; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIncDec.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIncDec.as new file mode 100644 index 000000000..82989f87d --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIncDec.as @@ -0,0 +1,49 @@ +package tests +{ + + public class TestIncDec + { + public function run():* + { + var a:* = 5; + var b:* = 0; + trace("++var"); + b = ++a; + trace("var++"); + b = a++; + trace("--var"); + b = --a; + trace("var--"); + b = a--; + var c:* = [1, 2, 3, 4, 5]; + trace("++arr"); + b = ++c[2]; + trace("arr++"); + b = c[2]++; + trace("--arr"); + b = --c[2]; + trace("arr--"); + b = c[2]--; + var d:* = new TestClass1(); + trace("++property"); + trace(++d.attrib); + trace("property++"); + trace(d.attrib++); + trace("--property"); + trace(--d.attrib); + trace("property--"); + trace(d.attrib--); + trace("arr[e++]"); + var chars:Array = new Array(36); + var index:uint = 0; + chars[index++] = 5; + trace("arr[++e]"); + chars[++index] = 5; + } + } +} + +class TestClass1 +{ + public var attrib:int = 5; +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInlineFunctions.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInlineFunctions.as new file mode 100644 index 000000000..11e0fcc82 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInlineFunctions.as @@ -0,0 +1,25 @@ +package tests +{ + + public class TestInlineFunctions + { + public function run():* + { + var first:String="value1"; + var traceParameter:Function=function(aParam:String):String + { + var second:String="value2"; + second=second + "cc"; + var traceParam2:Function=function(bParam:String):String + { + trace(bParam + "," + aParam); + return first + second + aParam + bParam; + } + trace(second); + traceParam2(aParam); + return first; + }; + traceParameter("hello"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerFunctions.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerFunctions.as new file mode 100644 index 000000000..60b256b30 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerFunctions.as @@ -0,0 +1,21 @@ +package tests +{ + + public class TestInnerFunctions + { + public function run(a:String):* + { + var s:int = 0; + var innerFunc:Function = function(b:String):* + { + trace(b); + }; + var k:int = 5; + if (k == 6) + { + s = 8; + } + innerFunc(a); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerIf.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerIf.as new file mode 100644 index 000000000..772a462a9 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerIf.as @@ -0,0 +1,33 @@ +package tests +{ + + public class TestInnerIf + { + public function run():* + { + var a:* = 5; + var b:* = 4; + if (a == 5) + { + if (b == 6) + { + trace("b==6"); + } + else + { + trace("b!=6"); + } + } + else if (b == 7) + { + trace("b==7"); + } + else + { + trace("b!=7"); + } + + trace("end"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerTry.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerTry.as new file mode 100644 index 000000000..a57d2cb6f --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerTry.as @@ -0,0 +1,30 @@ +package tests +{ + + public class TestInnerTry + { + public function run():* + { + try + { + try + { + trace("try body 1"); + } + catch (e:DefinitionError) + { + trace("catched DefinitionError"); + } + trace("after try 1"); + } + catch (e:Error) + { + trace("catched Error"); + } + finally + { + trace("finally block"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestLogicalComputing.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestLogicalComputing.as new file mode 100644 index 000000000..3b61798ba --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestLogicalComputing.as @@ -0,0 +1,19 @@ +package tests +{ + + public class TestLogicalComputing + { + public function run():* + { + var b:Boolean = false; + var i:* = 5; + var j:* = 7; + if (i > j) + { + j = 9; + b = true; + } + b = (i == 0 || i == 1) && j == 0; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestManualConvert.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestManualConvert.as new file mode 100644 index 000000000..6542c2753 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestManualConvert.as @@ -0,0 +1,12 @@ +package tests +{ + + public class TestManualConvert + { + public function run():* + { + trace("String(this).length"); + trace(String(this).length); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMissingDefault.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMissingDefault.as new file mode 100644 index 000000000..404e551ca --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMissingDefault.as @@ -0,0 +1,22 @@ +package tests +{ + + public class TestMissingDefault + { + public function run():* + { + var jj:int = 1; + switch (jj) + { + case 1: + jj = 1; + break; + case 2: + jj = 2; + break; + default: + jj = 3; + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMultipleCondition.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMultipleCondition.as new file mode 100644 index 000000000..fcd7da05e --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMultipleCondition.as @@ -0,0 +1,21 @@ +package tests +{ + + public class TestMultipleCondition + { + public function run():* + { + var a:* = 5; + var b:* = 8; + var c:* = 9; + if ((a <= 4 || b <= 8) && c == 7) + { + trace("onTrue"); + } + else + { + trace("onFalse"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNamedAnonFunctions.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNamedAnonFunctions.as new file mode 100644 index 000000000..4b0b8096b --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNamedAnonFunctions.as @@ -0,0 +1,19 @@ +package tests +{ + public class TestNamedAnonFunctions + { + public function run() : * + { + var test:* = new function testFunc(param1:*, param2:int, param3:Array):Boolean + { + return (param1 as TestClass2).attrib1 == 5; + }; + } + } +} + +class TestClass2 +{ + public var attrib1:int; +} + diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNames.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNames.as new file mode 100644 index 000000000..3f6264e52 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNames.as @@ -0,0 +1,32 @@ +package tests +{ + import tests_other.myInternal; + + public class TestNames + { + public function run():* + { + var ns:* = this.getNamespace(); + var name:* = this.getName(); + var a:* = ns::unnamespacedFunc(); + var b:* = ns::[name]; + trace(b.c); + var c:* = myInternal::neco; + } + + public function getNamespace():Namespace + { + return myInternal; + } + + public function getName():String + { + return "unnamespacedFunc"; + } + + myInternal function namespacedFunc() : void + { + trace("hello"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestOptionalParameters.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestOptionalParameters.as new file mode 100644 index 000000000..18b1f9400 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestOptionalParameters.as @@ -0,0 +1,12 @@ +package tests +{ + import flash.events.Event; + + public class TestOptionalParameters + { + public function run(p1:Event=null, p2:Number=1, p3:Number=-1, p4:Number=-1.1, p5:Number=-1.1, p6:String="a") : * + { + + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamNames.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamNames.as new file mode 100644 index 000000000..a345968c0 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamNames.as @@ -0,0 +1,11 @@ +package tests +{ + + public class TestParamNames + { + public function run(firstp:int, secondp:int, thirdp:int) : int + { + return firstp + secondp + thirdp; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamsCount.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamsCount.as new file mode 100644 index 000000000..3e0524855 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamsCount.as @@ -0,0 +1,11 @@ +package tests +{ + + public class TestParamsCount + { + public function run(firstp:int, secondp:int, thirdp:int):int + { + return firstp; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedence.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedence.as new file mode 100644 index 000000000..5b9ee0edb --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedence.as @@ -0,0 +1,22 @@ +package tests +{ + + public class TestPrecedence + { + public function run():* + { + var a:* = 0; + a = (5 + 6) * 7; + a = 5 * (2 + 3); + a = 5 + 6 * 7; + a = 5 * 2 + 2; + a = 5 * (25 % 3); + a = 5 % (24 * 307); + a = 1 / (2 / 3); + a = 1 / (2 * 3); + a = 1 * 2 * 3; + a = 1 * 2 / 3; + trace("a=" + a); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedenceX.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedenceX.as new file mode 100644 index 000000000..8bde0e572 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedenceX.as @@ -0,0 +1,15 @@ +package tests +{ + + public class TestPrecedenceX + { + public function run():* + { + var a:* = 5; + var b:* = 2; + var c:* = 3; + var d:* = a << (b >>> c); + var e:* = a << b >>> c; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestProperty.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestProperty.as new file mode 100644 index 000000000..5cd36f06c --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestProperty.as @@ -0,0 +1,27 @@ +package tests +{ + + public class TestProperty + { + public function run():* + { + var d:* = new TestClass1(); + var k:* = 7 + 8; + if (k == 15) + { + d.method(d.attrib * 5); + } + } + } +} + +class TestClass1 +{ + public var attrib:int = 5; + + public function method(i:int):int + { + trace("method"); + return 7; + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRegExp.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRegExp.as new file mode 100644 index 000000000..c50f46c3e --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRegExp.as @@ -0,0 +1,14 @@ +package tests +{ + + public class TestRegExp + { + public function run():* + { + var a1:* = /[a-z\r\n0-9\\]+/i; + var a2:* = /[a-z\r\n0-9\\]+/i; + var b1:* = /[0-9AB]+/; + var b2:* = /[0-9AB]+/; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRest.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRest.as new file mode 100644 index 000000000..10662bab1 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRest.as @@ -0,0 +1,12 @@ +package tests +{ + + public class TestRest + { + public function run(firstp:int, ... restval):int + { + trace("firstRest:" + restval[0]); + return firstp; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStringConcat.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStringConcat.as new file mode 100644 index 000000000..0cab21f30 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStringConcat.as @@ -0,0 +1,19 @@ +package tests +{ + + public class TestStringConcat + { + public function run():* + { + var k:int = 8; + this.traceIt("hello" + 5 * 6); + this.traceIt("hello" + (k - 1)); + this.traceIt("hello" + 5 + 6); + } + + private function traceIt(s:String) : void + { + trace(s); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStrings.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStrings.as new file mode 100644 index 000000000..20d3e4120 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStrings.as @@ -0,0 +1,15 @@ +package tests +{ + + public class TestStrings + { + public function run():* + { + trace("hello"); + trace("quotes:\"hello!\""); + trace("backslash: \\ "); + trace("single quotes: \'hello!\'"); + trace("new line \r\n hello!"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitch.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitch.as new file mode 100644 index 000000000..380aaba22 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitch.as @@ -0,0 +1,24 @@ +package tests +{ + + public class TestSwitch + { + public function run():* + { + var a:* = 5; + switch (a) + { + case 57 * a: + trace("fiftyseven multiply a"); + break; + case 13: + trace("thirteen"); + case 14: + trace("fourteen"); + break; + case 89: + trace("eightynine"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitchDefault.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitchDefault.as new file mode 100644 index 000000000..2ea550a56 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitchDefault.as @@ -0,0 +1,27 @@ +package tests +{ + + public class TestSwitchDefault + { + public function run():* + { + var a:* = 5; + switch (a) + { + case 57 * a: + trace("fiftyseven multiply a"); + break; + case 13: + trace("thirteen"); + case 14: + trace("fourteen"); + break; + case 89: + trace("eightynine"); + break; + default: + trace("default clause"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTernarOperator.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTernarOperator.as new file mode 100644 index 000000000..466183d83 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTernarOperator.as @@ -0,0 +1,16 @@ +package tests +{ + + public class TestTernarOperator + { + public function run():* + { + var a:* = 5; + var b:* = 4; + var c:* = 4; + var d:* = 78; + var e:* = a == b ? c == d ? 1 : 7 : 3; + trace("e=" + e); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTry.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTry.as new file mode 100644 index 000000000..3b86f8dd0 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTry.as @@ -0,0 +1,30 @@ +package tests +{ + + public class TestTry + { + public function run():* + { + var i:int = 0; + i = 7; + try + { + trace("try body"); + } + catch (e:DefinitionError) + { + trace("catched DefinitionError"); + } + catch (e:Error) + { + trace("Error message:" + e.message); + trace("Stacktrace:" + e.getStackTrace()); + } + finally + { + trace("Finally part"); + } + trace("end"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTryReturn.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTryReturn.as new file mode 100644 index 000000000..05d8ad06d --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTryReturn.as @@ -0,0 +1,37 @@ +package tests +{ + + public class TestTryReturn + { + public function run():* + { + var i:int = 0; + var b:Boolean = false; + try + { + i = 0; + b = true; + if (i > 0) + { + while (this.testDoWhile2()) + { + if (b) + { + return 5; + } + } + } + i++; + return 2; + } + catch (e:Error) + { + } + return 4; + } + + public function testDoWhile2() :Boolean{ + return true; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector.as new file mode 100644 index 000000000..338323f25 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector.as @@ -0,0 +1,15 @@ +package tests +{ + + public class TestVector + { + public function run():* + { + var v:Vector. = new Vector.(); + v.push("hello"); + v[0] = "hi"; + v[5 * 8 - 39] = "hi2"; + trace(v[0]); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector2.as new file mode 100644 index 000000000..9bfe4b2eb --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector2.as @@ -0,0 +1,12 @@ +package tests +{ + + public class TestVector2 + { + public function run():* + { + var a:Vector.> = new Vector.>(); + var b:Vector. = new [10, 20, 30]; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileAnd.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileAnd.as new file mode 100644 index 000000000..b540d17a3 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileAnd.as @@ -0,0 +1,19 @@ +package tests +{ + + public class TestWhileAnd + { + public function run():* + { + var a:int = 5; + var b:int = 10; + while (a < 10 && b > 1) + { + a++; + b--; + } + a = 7; + b = 9; + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileContinue.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileContinue.as new file mode 100644 index 000000000..e4b636737 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileContinue.as @@ -0,0 +1,27 @@ +package tests +{ + + public class TestWhileContinue + { + public function run():* + { + var a:* = 5; + while (true) + { + if (a == 9) + { + if (a == 8) + { + continue; + } + if (a == 9) + { + break; + } + trace("hello 1"); + } + trace("hello2"); + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry.as new file mode 100644 index 000000000..603275cc9 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry.as @@ -0,0 +1,29 @@ +package tests +{ + import flash.errors.EOFError; + + public class TestWhileTry + { + public function run():* + { + while (true) + { + try + { + while (true) + { + trace("a"); + } + } + catch (e:EOFError) + { + continue; + } + catch (e:Error) + { + continue; + } + } + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry2.as new file mode 100644 index 000000000..5f83ab186 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry2.as @@ -0,0 +1,32 @@ +package tests +{ + import flash.errors.EOFError; + + public class TestWhileTry2 + { + public function run():* + { + var j:* = undefined; + for (var i:* = 0; i < 100; i++) + { + try + { + for (j = 0; j < 20; j++) + { + trace("a"); + } + } + catch (e:EOFError) + { + continue; + } + catch (e:Error) + { + continue; + } + trace("after_try"); + } + trace("end"); + } + } +} diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/SetupMyPackage1.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/SetupMyPackage1.as new file mode 100644 index 000000000..c89fca656 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/SetupMyPackage1.as @@ -0,0 +1,17 @@ +package tests_classes.mypackage1 +{ + public class SetupMyPackage1 + { + myNamespace; + TestClass; + TestClass2; + TestInterface; + + public function SetupMyPackage1() + { + + } + + } + +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass.as new file mode 100644 index 000000000..c39e16b6a --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass.as @@ -0,0 +1,27 @@ +package tests_classes.mypackage1 +{ + import tests_classes.mypackage2.TestClass; + + public class TestClass implements tests_classes.mypackage1.TestInterface + { + public function testCall() : String + { + trace("pkg1hello"); + return "pkg1hello"; + } + + public function testMethod1() : void { + var a : tests_classes.mypackage1.TestInterface = this; + a.testMethod1(); + var b : tests_classes.mypackage2.TestInterface = this; + b = new tests_classes.mypackage2.TestClass(); + } + + public function testMethod2() : void { + var a : tests_classes.mypackage1.TestInterface = this; + a.testMethod1(); + var b : tests_classes.mypackage2.TestInterface = this; + b = new tests_classes.mypackage2.TestClass(); + } + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass2.as new file mode 100644 index 000000000..68c16e441 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass2.as @@ -0,0 +1,36 @@ +package tests_classes.mypackage1 +{ + import tests_classes.mypackage2.TestClass; + import tests_classes.mypackage3.TestClass; + + public class TestClass2 + { + public function testCall() : String + { + var a : tests_classes.mypackage1.TestClass; + a = new tests_classes.mypackage1.TestClass(); + var b : tests_classes.mypackage2.TestClass; + b = new tests_classes.mypackage2.TestClass(); + var c : tests_classes.mypackage3.TestClass; + c = new tests_classes.mypackage3.TestClass(); + var res:String = a.testCall() + b.testCall() + c.testCall() + testCall2() + myNamespace::testCall3(); + trace(res); + return res; + } + + myNamespace function testCall2() : String + { + return "1"; + } + + myNamespace function testCall3() : String + { + return myNamespace::testCall2(); + } + + public function testCall2() : String + { + return "2"; + } + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestInterface.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestInterface.as new file mode 100644 index 000000000..09ca8129e --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestInterface.as @@ -0,0 +1,9 @@ +package tests_classes.mypackage1 +{ + import tests_classes.mypackage2.TestInterface; + + public interface TestInterface extends tests_classes.mypackage2.TestInterface + { + function testMethod1() : void; + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/myNamespace.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/myNamespace.as new file mode 100644 index 000000000..f8c8fb181 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/myNamespace.as @@ -0,0 +1,4 @@ +package tests_classes.mypackage1 +{ + public namespace myNamespace = "https://www.free-decompiler.com/flash/test/namespace"; +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/SetupMyPackage2.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/SetupMyPackage2.as new file mode 100644 index 000000000..0e1cd9fe9 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/SetupMyPackage2.as @@ -0,0 +1,15 @@ +package tests_classes.mypackage2 +{ + public class SetupMyPackage2 + { + TestClass; + TestInterface; + + public function SetupMyPackage2() + { + + } + + } + +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestClass.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestClass.as new file mode 100644 index 000000000..7a02b9ef8 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestClass.as @@ -0,0 +1,15 @@ +package tests_classes.mypackage2 +{ + + public class TestClass implements TestInterface + { + public function testCall() : String + { + trace("pkg2hello"); + return "pkg2hello"; + } + + public function testMethod2() : void { + } + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestInterface.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestInterface.as new file mode 100644 index 000000000..0179aa41f --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestInterface.as @@ -0,0 +1,7 @@ +package tests_classes.mypackage2 +{ + public interface TestInterface + { + function testMethod2() : void; + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/SetupMyPackage3.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/SetupMyPackage3.as new file mode 100644 index 000000000..3e6c9e4cb --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/SetupMyPackage3.as @@ -0,0 +1,15 @@ +package tests_classes.mypackage3 +{ + public class SetupMyPackage3 + { + TestClass; + TestInterface; + + public function SetupMyPackage3() + { + + } + + } + +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestClass.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestClass.as new file mode 100644 index 000000000..c71e35935 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestClass.as @@ -0,0 +1,12 @@ +package tests_classes.mypackage3 +{ + + public class TestClass + { + public function testCall() : String + { + trace("pkg3hello"); + return "pkg3hello"; + } + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestInterface.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestInterface.as new file mode 100644 index 000000000..dfa1b61a2 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestInterface.as @@ -0,0 +1,7 @@ +package tests_classes.mypackage3 +{ + public interface TestInterface + { + function testMethod3() : void; + } +} \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_other/myInternal.as b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_other/myInternal.as new file mode 100644 index 000000000..57306d281 --- /dev/null +++ b/libsrc/ffdec_lib/testdata/flashdevelop/src/tests_other/myInternal.as @@ -0,0 +1,4 @@ +package tests_other +{ + public namespace myInternal = "http://www.adobe.com/2006/actionscript/examples"; +} \ No newline at end of file