mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-29 18:34:42 +00:00
AS3 test methods separated to classes, Fixed AS3: get/set slot for global scope
This commit is contained in:
@@ -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<GraphTargetItem> 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<GraphTargetItem> cinitBody = p.abc.findBody(cinit).convertedItems;
|
||||
for (GraphTargetItem cit : cinitBody) {
|
||||
if (cit instanceof SetPropertyAVM2Item) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
@@ -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<GraphPart> stopPart2 = new ArrayList<>(stopPart);
|
||||
stopPart2.add(nepart);
|
||||
if (retPart != null) {
|
||||
|
||||
@@ -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<GraphTargetItem> output, String path) {
|
||||
if (localData.scopeStack.isEmpty()) {
|
||||
if (localData.scopeStack.isEmpty()) {
|
||||
if (localData.classIndex == -1) {
|
||||
/*if (localData.classIndex == -1) {
|
||||
|
||||
} else {
|
||||
stack.push(new ClassAVM2Item(localData.getInstanceInfo().get(localData.classIndex).getName(localData.getConstants())));
|
||||
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));
|
||||
|
||||
@@ -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<Trait> traits = localData.getScriptInfo().get(((ScriptAVM2Item) obj).scriptIndex).traits.traits;
|
||||
} else if ((obj instanceof ThisAVM2Item) || (obj instanceof ClassAVM2Item) || (obj instanceof ScriptAVM2Item)) {
|
||||
List<Trait> 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) {
|
||||
|
||||
@@ -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<Trait> traits = localData.getScriptInfo().get(((ScriptAVM2Item) obj).scriptIndex).traits.traits;
|
||||
List<Trait> 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) {
|
||||
|
||||
@@ -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) {
|
||||
if (body != null) {
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<>());
|
||||
|
||||
@@ -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<Traits> ts = new ArrayList<>();
|
||||
ts.add(classInfo.static_traits);
|
||||
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(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<Traits> ts = new ArrayList<>();
|
||||
ts.add(instanceInfo.instance_traits);
|
||||
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(scriptIndex), GraphTextWriter.TRAIT_INSTANCE_INITIALIZER, writer, fullyQualifiedNames, ts, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
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(classIndex), 0, writer, fullyQualifiedNames, null, true);
|
||||
}
|
||||
writer.endMethod();
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
if (bodyIndex != -1) {
|
||||
abc.bodies.get(bodyIndex).convert(convertData, path, exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, new ScopeStack(scriptIndex), 0, writer, fullyQualifiedNames, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
try {
|
||||
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<GraphTargetItem> 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 {
|
||||
try {
|
||||
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<GraphTargetItem> 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 {
|
||||
try {
|
||||
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<GraphTargetItem> iinitBody = pack.abc.findBody(iinit).convertedItems;
|
||||
for (GraphTargetItem it : iinitBody) {
|
||||
if (it instanceof InitPropertyAVM2Item) {
|
||||
|
||||
@@ -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<Integer, Integer> 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<>());
|
||||
|
||||
|
||||
@@ -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<GraphTargetItem> 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<GraphTargetItem> 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<List<GraphTargetItem>> subs = ((Block) item).getSubs();
|
||||
for (List<GraphTargetItem> sub : subs) {
|
||||
expandGotos(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processIfs(List<GraphTargetItem> list) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
GraphTargetItem item = list.get(i);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public void init() throws IOException, InterruptedException {
|
||||
//Main.initLogging(false);
|
||||
//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);
|
||||
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) {
|
||||
private void decompileMethod(String methodName, String expectedResult, boolean isStatic) {
|
||||
String className = methodName.substring(0, 1).toUpperCase() + methodName.substring(1);
|
||||
|
||||
int clsIndex = -1;
|
||||
int scriptIndex = -1;
|
||||
|
||||
ABC abc = null;
|
||||
List<ABC> 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<Traits> ts = new ArrayList<>();
|
||||
ts.add(abc.instance_info.get(clsIndex).instance_traits);
|
||||
ts.add(abc.instance_info.get(clsIndex).instance_traits);
|
||||
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);
|
||||
writer = new HighlightedTextWriter(new CodeFormatting(), false);
|
||||
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) {
|
||||
private void decompileScriptPack(String path, String expectedResult) {
|
||||
ScriptPack scriptPack = abc.findScriptPackByPath(path, Arrays.asList(abc));
|
||||
|
||||
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 {
|
||||
try {
|
||||
List<Traits> ts = new ArrayList<>();
|
||||
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() {
|
||||
public void testMyPackage1TestClass() {
|
||||
decompileScriptPack("tests_classes.mypackage1.TestClass", "package tests_classes.mypackage1\n"
|
||||
+ "{\n"
|
||||
+ "{\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"
|
||||
+ " {\n"
|
||||
+ " var a:tests_classes.mypackage1.TestInterface = this;\n"
|
||||
+ " a.testMethod1();\n"
|
||||
+ " a.testMethod1();\n"
|
||||
+ " var b:classes.mypackage2.TestInterface = this;\n"
|
||||
+ " var b:tests_classes.mypackage2.TestInterface = this;\n"
|
||||
+ " b = new tests_classes.mypackage2.TestClass();\n"
|
||||
+ " }\n"
|
||||
+ " \n"
|
||||
+ " public function testMethod2() : void\n"
|
||||
+ " {\n"
|
||||
+ " {\n"
|
||||
+ " var a:tests_classes.mypackage1.TestInterface = this;\n"
|
||||
+ " a.testMethod1();\n"
|
||||
+ " a.testMethod1();\n"
|
||||
+ " var b:classes.mypackage2.TestInterface = this;\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() {
|
||||
public void testMyPackage1TestClass2() {
|
||||
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"
|
||||
+ " \n"
|
||||
+ " public function testCall() : String\n"
|
||||
+ " {\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"
|
||||
+ " 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() {
|
||||
public void testMyPackage1TestInterface() {
|
||||
decompileScriptPack("tests_classes.mypackage1.TestInterface", "package tests_classes.mypackage1\n"
|
||||
+ "{\n"
|
||||
+ "{\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() {
|
||||
public void testMyPackage1MyNamespace() {
|
||||
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() {
|
||||
public void testMyPackage2TestClass() {
|
||||
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() {
|
||||
public void testMyPackage2TestInterface() {
|
||||
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() {
|
||||
public void testMyPackage3TestClass() {
|
||||
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";
|
||||
String methodName = "testOptionalParameters";
|
||||
int methodInfo = abc.findMethodInfoByName(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);
|
||||
|
||||
@@ -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);
|
||||
Configuration.autoDeobfuscate.set(false);
|
||||
SWF swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/flashdevelop/bin/flashdevelop.swf")), false);
|
||||
DoABC2Tag tag = null;
|
||||
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();
|
||||
List<ScriptPack> scriptPacks = swf.getAS3Packs();
|
||||
|
||||
StringBuilder s = new StringBuilder();
|
||||
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<Traits> 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) {
|
||||
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<Traits> 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(", false);");
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
BIN
libsrc/ffdec_lib/testdata/flashdevelop/bin/expressInstall.swf
vendored
Normal file
BIN
libsrc/ffdec_lib/testdata/flashdevelop/bin/expressInstall.swf
vendored
Normal file
Binary file not shown.
BIN
libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf
vendored
Normal file
BIN
libsrc/ffdec_lib/testdata/flashdevelop/bin/flashdevelop.swf
vendored
Normal file
Binary file not shown.
40
libsrc/ffdec_lib/testdata/flashdevelop/bin/index.html
vendored
Normal file
40
libsrc/ffdec_lib/testdata/flashdevelop/bin/index.html
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>flashdevelop</title>
|
||||
<meta name="description" content="" />
|
||||
|
||||
<script src="js/swfobject.js"></script>
|
||||
<script>
|
||||
var flashvars = {
|
||||
};
|
||||
var params = {
|
||||
menu: "false",
|
||||
scale: "noScale",
|
||||
allowFullscreen: "true",
|
||||
allowScriptAccess: "always",
|
||||
bgcolor: "",
|
||||
wmode: "direct" // can cause issues with FP settings & webcam
|
||||
};
|
||||
var attributes = {
|
||||
id:"flashdevelop"
|
||||
};
|
||||
swfobject.embedSWF(
|
||||
"flashdevelop.swf",
|
||||
"altContent", "100%", "100%", "10.0.0",
|
||||
"expressInstall.swf",
|
||||
flashvars, params, attributes);
|
||||
</script>
|
||||
<style>
|
||||
html, body { height:100%; overflow:hidden; }
|
||||
body { margin:0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="altContent">
|
||||
<h1>flashdevelop</h1>
|
||||
<p><a href="http://www.adobe.com/go/getflashplayer">Get Adobe Flash player</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
4
libsrc/ffdec_lib/testdata/flashdevelop/bin/js/swfobject.js
vendored
Normal file
4
libsrc/ffdec_lib/testdata/flashdevelop/bin/js/swfobject.js
vendored
Normal file
File diff suppressed because one or more lines are too long
93
libsrc/ffdec_lib/testdata/flashdevelop/flashdevelop.as3proj
vendored
Normal file
93
libsrc/ffdec_lib/testdata/flashdevelop/flashdevelop.as3proj
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project version="2">
|
||||
<!-- Output SWF options -->
|
||||
<output>
|
||||
<movie outputType="Application" />
|
||||
<movie input="" />
|
||||
<movie path="bin\flashdevelop.swf" />
|
||||
<movie fps="30" />
|
||||
<movie width="800" />
|
||||
<movie height="600" />
|
||||
<movie version="25" />
|
||||
<movie minorVersion="0" />
|
||||
<movie platform="Flash Player" />
|
||||
<movie background="#FFFFFF" />
|
||||
</output>
|
||||
<!-- Other classes to be compiled into your SWF -->
|
||||
<classpaths>
|
||||
<class path="src" />
|
||||
</classpaths>
|
||||
<!-- Build options -->
|
||||
<build>
|
||||
<option accessible="False" />
|
||||
<option advancedTelemetry="False" />
|
||||
<option allowSourcePathOverlap="False" />
|
||||
<option benchmark="False" />
|
||||
<option es="False" />
|
||||
<option inline="False" />
|
||||
<option locale="" />
|
||||
<option loadConfig="" />
|
||||
<option optimize="True" />
|
||||
<option omitTraces="True" />
|
||||
<option showActionScriptWarnings="True" />
|
||||
<option showBindingWarnings="True" />
|
||||
<option showInvalidCSS="True" />
|
||||
<option showDeprecationWarnings="True" />
|
||||
<option showUnusedTypeSelectorWarnings="True" />
|
||||
<option strict="True" />
|
||||
<option useNetwork="True" />
|
||||
<option useResourceBundleMetadata="True" />
|
||||
<option warnings="True" />
|
||||
<option verboseStackTraces="False" />
|
||||
<option linkReport="" />
|
||||
<option loadExterns="" />
|
||||
<option staticLinkRSL="True" />
|
||||
<option additional="" />
|
||||
<option compilerConstants="" />
|
||||
<option minorVersion="" />
|
||||
</build>
|
||||
<!-- SWC Include Libraries -->
|
||||
<includeLibraries>
|
||||
<!-- example: <element path="..." /> -->
|
||||
</includeLibraries>
|
||||
<!-- SWC Libraries -->
|
||||
<libraryPaths>
|
||||
<!-- example: <element path="..." /> -->
|
||||
</libraryPaths>
|
||||
<!-- External Libraries -->
|
||||
<externalLibraryPaths>
|
||||
<!-- example: <element path="..." /> -->
|
||||
</externalLibraryPaths>
|
||||
<!-- Runtime Shared Libraries -->
|
||||
<rslPaths>
|
||||
<!-- example: <element path="..." /> -->
|
||||
</rslPaths>
|
||||
<!-- Intrinsic Libraries -->
|
||||
<intrinsics>
|
||||
<!-- example: <element path="..." /> -->
|
||||
</intrinsics>
|
||||
<!-- Assets to embed into the output SWF -->
|
||||
<library>
|
||||
<!-- example: <asset path="..." id="..." update="..." glyphs="..." mode="..." place="..." sharepoint="..." /> -->
|
||||
</library>
|
||||
<!-- Class files to compile (other referenced classes will automatically be included) -->
|
||||
<compileTargets>
|
||||
<compile path="src\Main.as" />
|
||||
</compileTargets>
|
||||
<!-- Paths to exclude from the Project Explorer tree -->
|
||||
<hiddenPaths>
|
||||
<hidden path="obj" />
|
||||
</hiddenPaths>
|
||||
<!-- Executed before build -->
|
||||
<preBuildCommand />
|
||||
<!-- Executed after build -->
|
||||
<postBuildCommand alwaysRun="False" />
|
||||
<!-- Other project options -->
|
||||
<options>
|
||||
<option showHiddenPaths="False" />
|
||||
<option testMovie="Default" />
|
||||
<option testMovieCommand="" />
|
||||
</options>
|
||||
<!-- Plugin storage -->
|
||||
<storage />
|
||||
</project>
|
||||
48
libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old
vendored
Normal file
48
libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.old
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--This Adobe Flex compiler configuration file was generated by a tool.-->
|
||||
<!--Any modifications you make may be lost.-->
|
||||
<flex-config>
|
||||
<target-player>25.0</target-player>
|
||||
<benchmark>false</benchmark>
|
||||
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
|
||||
<compiler>
|
||||
<define append="true">
|
||||
<name>CONFIG::debug</name>
|
||||
<value>true</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::release</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'18.01.2021'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::mobile</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::desktop</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src\Main.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
<default-size>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</default-size>
|
||||
</flex-config>
|
||||
48
libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml
vendored
Normal file
48
libsrc/ffdec_lib/testdata/flashdevelop/obj/flashdevelopConfig.xml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--This Adobe Flex compiler configuration file was generated by a tool.-->
|
||||
<!--Any modifications you make may be lost.-->
|
||||
<flex-config>
|
||||
<target-player>25.0</target-player>
|
||||
<benchmark>false</benchmark>
|
||||
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
|
||||
<compiler>
|
||||
<define append="true">
|
||||
<name>CONFIG::debug</name>
|
||||
<value>true</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::release</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'18.01.2021'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::mobile</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::desktop</name>
|
||||
<value>false</value>
|
||||
</define>
|
||||
<verbose-stacktraces>true</verbose-stacktraces>
|
||||
<source-path append="true">
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src</path-element>
|
||||
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
|
||||
</source-path>
|
||||
</compiler>
|
||||
<file-specs>
|
||||
<path-element>C:\Dropbox\Programovani\JavaSE\FFDec\libsrc\ffdec_lib\testdata\flashdevelop\src\Main.as</path-element>
|
||||
</file-specs>
|
||||
<default-background-color>#FFFFFF</default-background-color>
|
||||
<default-frame-rate>30</default-frame-rate>
|
||||
<default-size>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</default-size>
|
||||
</flex-config>
|
||||
91
libsrc/ffdec_lib/testdata/flashdevelop/src/Main.as
vendored
Normal file
91
libsrc/ffdec_lib/testdata/flashdevelop/src/Main.as
vendored
Normal file
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestArguments.as
vendored
Normal file
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestArguments.as
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestArguments
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
return arguments[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
24
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestCatchFinally.as
vendored
Normal file
24
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestCatchFinally.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChain2.as
vendored
Normal file
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChain2.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChainedAssignments.as
vendored
Normal file
49
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestChainedAssignments.as
vendored
Normal file
@@ -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";
|
||||
}
|
||||
}
|
||||
13
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestComplexExpressions.as
vendored
Normal file
13
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestComplexExpressions.as
vendored
Normal file
@@ -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++);
|
||||
}
|
||||
}
|
||||
}
|
||||
66
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestContinueLevels.as
vendored
Normal file
66
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestContinueLevels.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDecl2.as
vendored
Normal file
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDecl2.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDeclarations.as
vendored
Normal file
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDeclarations.as
vendored
Normal file
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
23
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDefaultNotLastGrouped.as
vendored
Normal file
23
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDefaultNotLastGrouped.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
17
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile.as
vendored
Normal file
17
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile.as
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestDoWhile
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
var a:* = 8;
|
||||
do
|
||||
{
|
||||
trace("a=" + a);
|
||||
a++;
|
||||
} while (a < 20);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
26
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile2.as
vendored
Normal file
26
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestDoWhile2.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestExpressions.as
vendored
Normal file
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestExpressions.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFinallyZeroJump.as
vendored
Normal file
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFinallyZeroJump.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFor.as
vendored
Normal file
14
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestFor.as
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestFor
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
for (var a:* = 0; a < 10; a++)
|
||||
{
|
||||
trace("a=" + a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForBreak.as
vendored
Normal file
18
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForBreak.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForContinue.as
vendored
Normal file
33
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForContinue.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEach.as
vendored
Normal file
20
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEach.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectArray.as
vendored
Normal file
22
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectArray.as
vendored
Normal file
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectAttribute.as
vendored
Normal file
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForEachObjectAttribute.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForIn.as
vendored
Normal file
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestForIn.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestHello.as
vendored
Normal file
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestHello.as
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestHello
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
trace("hello");
|
||||
}
|
||||
}
|
||||
}
|
||||
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIf.as
vendored
Normal file
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIf.as
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestIf
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
var a:* = 5;
|
||||
if (a == 7)
|
||||
{
|
||||
trace("onTrue");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIfElse.as
vendored
Normal file
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIfElse.as
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestIfElse
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
var a:* = 5;
|
||||
if (a == 7)
|
||||
{
|
||||
trace("onTrue");
|
||||
}
|
||||
else
|
||||
{
|
||||
trace("onFalse");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInc2.as
vendored
Normal file
23
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInc2.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIncDec.as
vendored
Normal file
49
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestIncDec.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
25
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInlineFunctions.as
vendored
Normal file
25
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInlineFunctions.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerFunctions.as
vendored
Normal file
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerFunctions.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerIf.as
vendored
Normal file
33
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerIf.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerTry.as
vendored
Normal file
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestInnerTry.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestLogicalComputing.as
vendored
Normal file
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestLogicalComputing.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestManualConvert.as
vendored
Normal file
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestManualConvert.as
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestManualConvert
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
trace("String(this).length");
|
||||
trace(String(this).length);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMissingDefault.as
vendored
Normal file
22
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMissingDefault.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMultipleCondition.as
vendored
Normal file
21
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestMultipleCondition.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNamedAnonFunctions.as
vendored
Normal file
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNamedAnonFunctions.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
32
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNames.as
vendored
Normal file
32
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestNames.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestOptionalParameters.as
vendored
Normal file
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestOptionalParameters.as
vendored
Normal file
@@ -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") : *
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamNames.as
vendored
Normal file
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamNames.as
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestParamNames
|
||||
{
|
||||
public function run(firstp:int, secondp:int, thirdp:int) : int
|
||||
{
|
||||
return firstp + secondp + thirdp;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamsCount.as
vendored
Normal file
11
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestParamsCount.as
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestParamsCount
|
||||
{
|
||||
public function run(firstp:int, secondp:int, thirdp:int):int
|
||||
{
|
||||
return firstp;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedence.as
vendored
Normal file
22
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedence.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedenceX.as
vendored
Normal file
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestPrecedenceX.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestProperty.as
vendored
Normal file
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestProperty.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
14
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRegExp.as
vendored
Normal file
14
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRegExp.as
vendored
Normal file
@@ -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]+/;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRest.as
vendored
Normal file
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestRest.as
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestRest
|
||||
{
|
||||
public function run(firstp:int, ... restval):int
|
||||
{
|
||||
trace("firstRest:" + restval[0]);
|
||||
return firstp;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStringConcat.as
vendored
Normal file
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStringConcat.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStrings.as
vendored
Normal file
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestStrings.as
vendored
Normal file
@@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
24
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitch.as
vendored
Normal file
24
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitch.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitchDefault.as
vendored
Normal file
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestSwitchDefault.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTernarOperator.as
vendored
Normal file
16
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTernarOperator.as
vendored
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTry.as
vendored
Normal file
30
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTry.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
37
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTryReturn.as
vendored
Normal file
37
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestTryReturn.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector.as
vendored
Normal file
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector.as
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestVector
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
var v:Vector.<String> = new Vector.<String>();
|
||||
v.push("hello");
|
||||
v[0] = "hi";
|
||||
v[5 * 8 - 39] = "hi2";
|
||||
trace(v[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector2.as
vendored
Normal file
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestVector2.as
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
package tests
|
||||
{
|
||||
|
||||
public class TestVector2
|
||||
{
|
||||
public function run():*
|
||||
{
|
||||
var a:Vector.<Vector.<int>> = new Vector.<Vector.<int>>();
|
||||
var b:Vector.<int> = new <int>[10, 20, 30];
|
||||
}
|
||||
}
|
||||
}
|
||||
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileAnd.as
vendored
Normal file
19
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileAnd.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileContinue.as
vendored
Normal file
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileContinue.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry.as
vendored
Normal file
29
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry.as
vendored
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry2.as
vendored
Normal file
32
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestWhileTry2.as
vendored
Normal file
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
17
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/SetupMyPackage1.as
vendored
Normal file
17
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/SetupMyPackage1.as
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package tests_classes.mypackage1
|
||||
{
|
||||
public class SetupMyPackage1
|
||||
{
|
||||
myNamespace;
|
||||
TestClass;
|
||||
TestClass2;
|
||||
TestInterface;
|
||||
|
||||
public function SetupMyPackage1()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass.as
vendored
Normal file
27
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass.as
vendored
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass2.as
vendored
Normal file
36
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestClass2.as
vendored
Normal file
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
9
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestInterface.as
vendored
Normal file
9
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/TestInterface.as
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
package tests_classes.mypackage1
|
||||
{
|
||||
import tests_classes.mypackage2.TestInterface;
|
||||
|
||||
public interface TestInterface extends tests_classes.mypackage2.TestInterface
|
||||
{
|
||||
function testMethod1() : void;
|
||||
}
|
||||
}
|
||||
4
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/myNamespace.as
vendored
Normal file
4
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage1/myNamespace.as
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
package tests_classes.mypackage1
|
||||
{
|
||||
public namespace myNamespace = "https://www.free-decompiler.com/flash/test/namespace";
|
||||
}
|
||||
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/SetupMyPackage2.as
vendored
Normal file
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/SetupMyPackage2.as
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package tests_classes.mypackage2
|
||||
{
|
||||
public class SetupMyPackage2
|
||||
{
|
||||
TestClass;
|
||||
TestInterface;
|
||||
|
||||
public function SetupMyPackage2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestClass.as
vendored
Normal file
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestClass.as
vendored
Normal file
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
7
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestInterface.as
vendored
Normal file
7
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage2/TestInterface.as
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
package tests_classes.mypackage2
|
||||
{
|
||||
public interface TestInterface
|
||||
{
|
||||
function testMethod2() : void;
|
||||
}
|
||||
}
|
||||
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/SetupMyPackage3.as
vendored
Normal file
15
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/SetupMyPackage3.as
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package tests_classes.mypackage3
|
||||
{
|
||||
public class SetupMyPackage3
|
||||
{
|
||||
TestClass;
|
||||
TestInterface;
|
||||
|
||||
public function SetupMyPackage3()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestClass.as
vendored
Normal file
12
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestClass.as
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
package tests_classes.mypackage3
|
||||
{
|
||||
|
||||
public class TestClass
|
||||
{
|
||||
public function testCall() : String
|
||||
{
|
||||
trace("pkg3hello");
|
||||
return "pkg3hello";
|
||||
}
|
||||
}
|
||||
}
|
||||
7
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestInterface.as
vendored
Normal file
7
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_classes/mypackage3/TestInterface.as
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
package tests_classes.mypackage3
|
||||
{
|
||||
public interface TestInterface
|
||||
{
|
||||
function testMethod3() : void;
|
||||
}
|
||||
}
|
||||
4
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_other/myInternal.as
vendored
Normal file
4
libsrc/ffdec_lib/testdata/flashdevelop/src/tests_other/myInternal.as
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
package tests_other
|
||||
{
|
||||
public namespace myInternal = "http://www.adobe.com/2006/actionscript/examples";
|
||||
}
|
||||
Reference in New Issue
Block a user