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 000000000..86958bf3a Binary files /dev/null and b/libsrc/ffdec_lib/testdata/flashdevelop/bin/expressInstall.swf differ diff --git a/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf b/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf new file mode 100644 index 000000000..880bcf125 Binary files /dev/null and b/libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf differ 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