diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java index 79a5c19b5..329f5b0a9 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -1065,6 +1065,19 @@ public class ABC { } } + public int findMethodInfoByName(int classId, String methodName) { + if (classId > -1) { + for (Trait t : instance_info[classId].instance_traits.traits) { + if (t instanceof TraitMethodGetterSetter) { + if (t.getName(this).getName(constants, new ArrayList()).equals(methodName)) { + return ((TraitMethodGetterSetter) t).method_info; + } + } + } + } + return -1; + } + public int findMethodBodyByName(int classId, String methodName) { if (classId > -1) { for (Trait t : instance_info[classId].instance_traits.traits) { diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java index bc574c33f..2071775f4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/parser/ASM3Parser.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.abc.avm2.parser; +import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.abc.avm2.AVM2Code; import com.jpexs.decompiler.flash.abc.avm2.ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; @@ -407,7 +408,18 @@ public class ASM3Parser { /*case ParsedSymbol.TYPE_KEYWORD_DECIMAL: value_kind = ValueKind.CONSTANT_Decimal; break;*/ + case ParsedSymbol.TYPE_INTEGER: + value_kind = ValueKind.CONSTANT_Int; + value_index = constants.getIntId((Long) type.value, true); + break; + case ParsedSymbol.TYPE_FLOAT: + value_kind = ValueKind.CONSTANT_Double; + value_index = constants.getDoubleId((Double) type.value, true); + break; case ParsedSymbol.TYPE_STRING: + value_kind = ValueKind.CONSTANT_Utf8; + value_index = constants.getStringId((String) type.value, true); + break; case ParsedSymbol.TYPE_KEYWORD_UTF8: value_kind = ValueKind.CONSTANT_Utf8; expected(ParsedSymbol.TYPE_PARENT_OPEN, "(", lexer); @@ -463,6 +475,10 @@ public class ASM3Parser { lexer.pushback(type); value_index = parseNamespace(constants, lexer); break; + default: + if (Configuration.debugMode) { + throw new ParseException("Not suppoerted valueType.", lexer.yyline()); + } } return new ValueKind(value_index, value_kind); } diff --git a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java index 2d1f28533..d93312855 100644 --- a/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java +++ b/trunk/src/com/jpexs/decompiler/graph/model/WhileItem.java @@ -73,7 +73,7 @@ public class WhileItem extends LoopItem implements Block { } } writer.unindent(); - writer.append("}").newLine(); + writer.append("}"); if (writer instanceof NulWriter) { LoopWithType loopOjb = ((NulWriter)writer).endLoop(loop.id); labelUsed = loopOjb.used; diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java index 8a58a8410..4e75d8b36 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript2AssemblerTest.java @@ -3,7 +3,6 @@ package com.jpexs.decompiler.flash; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.pcode.ASMParser; -import com.jpexs.decompiler.flash.helpers.HilightedText; import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.tags.DoActionTag; import com.jpexs.decompiler.graph.ExportMode; @@ -41,12 +40,14 @@ public class ActionScript2AssemblerTest extends ActionStript2TestBase { DoActionTag doa = getFirstActionTag(); doa.setActionBytes(Action.actionsToBytes(actions, true, swf.version)); - HilightedText actualResult = Action.actionsToSource(doa.getActions(swf.version), swf.version, "", false, 0); HilightedTextWriter writer = new HilightedTextWriter(false); + Action.actionsToSource(doa.getActions(swf.version), swf.version, "", writer); + String actualResult = writer.toString(); + writer = new HilightedTextWriter(false); doa.getASMSource(swf.version, ExportMode.PCODE, writer, null); String decompiled = writer.toString(); - assertEquals(actualResult.text.trim(), "ok = false;"); + assertEquals(actualResult.trim(), "ok = false;"); assertTrue(decompiled.contains("Push \"ok\" false")); } catch (IOException | ParseException ex) { fail(); diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java index 21df5922f..5cd40d429 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java @@ -19,7 +19,7 @@ package com.jpexs.decompiler.flash; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.ParseException; import com.jpexs.decompiler.flash.action.parser.pcode.ASMParser; -import com.jpexs.decompiler.flash.helpers.HilightedText; +import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.tags.DoActionTag; import java.io.FileInputStream; import java.io.IOException; @@ -74,9 +74,11 @@ public class ActionScript2DeobfuscatorTest extends ActionStript2TestBase { DoActionTag doa = getFirstActionTag(); doa.setActionBytes(Action.actionsToBytes(actions, true, swf.version)); - HilightedText actualResult = Action.actionsToSource(doa.getActions(swf.version), swf.version, "", false, 0); + HilightedTextWriter writer = new HilightedTextWriter(false); + Action.actionsToSource(doa.getActions(swf.version), swf.version, "", writer); + String actualResult = writer.toString(); - assertTrue(actualResult.text.contains("case \"c\":")); + assertTrue(actualResult.contains("case \"c\":")); } catch (IOException | ParseException ex) { fail(); } diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java index 990656308..12e88ca35 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript2Test.java @@ -17,7 +17,7 @@ package com.jpexs.decompiler.flash; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.helpers.HilightedText; +import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.tags.DoActionTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag; import com.jpexs.decompiler.flash.tags.Tag; @@ -42,8 +42,9 @@ public class ActionScript2Test extends ActionStript2TestBase { private void compareSrc(int frame, String expectedResult) { DoActionTag doa = getFrameSource(frame); assertNotNull(doa); - HilightedText hilightedText = Action.actionsToSource(doa.getActions(swf.version), swf.version, "", false, 0); - String actualResult = hilightedText.text.replaceAll("[ \r\n]", ""); + HilightedTextWriter writer = new HilightedTextWriter(false); + Action.actionsToSource(doa.getActions(swf.version), swf.version, "", writer); + String actualResult = writer.toString().replaceAll("[ \r\n]", ""); expectedResult = expectedResult.replaceAll("[ \r\n]", ""); assertEquals(actualResult, expectedResult); diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java index 341098968..51cfdea45 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java @@ -847,4 +847,19 @@ public class ActionScript3Test { + "}\r\n" + "return 4;\r\n", false); } + + @Test + public void testOptionalParameters() { + String methodName = "testOptionalParameters"; + int methodInfo = abc.findMethodInfoByName(clsIndex, methodName); + int bodyIndex = abc.findMethodBodyByName(clsIndex, methodName); + assertTrue(methodInfo > -1); + assertTrue(bodyIndex > -1); + HilightedTextWriter writer = new HilightedTextWriter(false); + abc.method_info[methodInfo].getParamStr(writer, abc.constants, abc.bodies[bodyIndex], abc, new ArrayList()); + String actualResult = writer.toString().replaceAll("[ \r\n]", ""); + String expectedResult = "p1:Event=null,p2:Number=1,p3:Number=-1,p4:Number=-1.1,p5:Number=-1.1,p6:String=\"a\""; + expectedResult = expectedResult.replaceAll("[ \r\n]", ""); + assertEquals(actualResult, expectedResult); + } } diff --git a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java index 67e72ff9e..74dc1eda0 100644 --- a/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java +++ b/trunk/test/com/jpexs/decompiler/flash/generators/AS2Generator.java @@ -3,7 +3,7 @@ package com.jpexs.decompiler.flash.generators; import com.jpexs.decompiler.flash.Configuration; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.action.Action; -import com.jpexs.decompiler.flash.helpers.HilightedText; +import com.jpexs.decompiler.flash.helpers.HilightedTextWriter; import com.jpexs.decompiler.flash.tags.DoABCDefineTag; import com.jpexs.decompiler.flash.tags.DoActionTag; import com.jpexs.decompiler.flash.tags.ShowFrameTag; @@ -35,8 +35,9 @@ public class AS2Generator { if (doa == null) { continue; } - HilightedText hilightedText = Action.actionsToSource(doa.getActions(swf.version), swf.version,"",false, 0); - String src = hilightedText.text; + HilightedTextWriter writer = new HilightedTextWriter(false); + Action.actionsToSource(doa.getActions(swf.version), swf.version, "", writer); + String src = writer.toString(); if (src.trim().equals("")) { doa = null; continue; diff --git a/trunk/testdata/as3/classes/Test.as b/trunk/testdata/as3/classes/Test.as index 72c0764b5..e0bdbd2cb 100644 --- a/trunk/testdata/as3/classes/Test.as +++ b/trunk/testdata/as3/classes/Test.as @@ -1,45 +1,45 @@ package classes { - + import flash.utils.Dictionary; import classes.myInternal; import flash.errors.EOFError; - + public class Test { - private var testPriv:int = 5; - protected var testProt:int = 9; + private var testPriv:int=5; + protected var testProt:int=9; public var t3:TestClass3; - public static const p:int = 8; - + public static const p:int=8; + public function testHello() { trace("hello"); } - + public function testIncDec() { - var a = 5; - var b = 0; + var a=5; + var b=0; trace("++var"); - b = ++a; + b=++a; trace("var++"); - b = a++; + b=a++; trace("--var"); - b = --a; + b=--a; trace("var--"); - b = a--; - var c = [1, 2, 3, 4, 5]; + b=a--; + var c=[1, 2, 3, 4, 5]; trace("++arr"); - b = ++c[2]; + b=++c[2]; trace("arr++"); - b = c[2]++; + b=c[2]++; trace("--arr"); - b = --c[2]; + b=--c[2]; trace("arr--"); - b = c[2]--; - - var d = new TestClass1(); + b=c[2]--; + + var d=new TestClass1(); trace("++property"); trace(++d.attrib); trace("property++"); @@ -48,22 +48,22 @@ trace(--d.attrib); trace("property--"); trace(d.attrib--); - + trace("arr[e++]"); - - var chars:Array = new Array(36); - var index:uint = 0; - - chars[index++] = 5; - + + var chars:Array=new Array(36); + var index:uint=0; + + chars[index++]=5; + trace("arr[++e]"); - chars[++index] = 5; + chars[++index]=5; return; } - + public function testDoWhile() { - var a = 8; + var a=8; do { trace("a=" + a); @@ -71,7 +71,7 @@ } while (a < 20); return; } - + public function testInnerTry() { try @@ -95,10 +95,10 @@ trace("finally block"); } } - + public function testWhileContinue() { - var a = 5; + var a=5; while (true) { if (a == 9) @@ -117,18 +117,18 @@ } return; } - + public function testPrecedence() { - var a = 0; - a = (5 + 6) * 7; - a = 5 * (2 + 3); - a = 5 + 6 * 7; - a = 5 * 2 + 2; + var a=0; + a=(5 + 6) * 7; + a=5 * (2 + 3); + a=5 + 6 * 7; + a=5 * 2 + 2; trace("a=" + a); return; } - + public function testStrings() { trace("hello"); @@ -137,15 +137,15 @@ trace("single quotes: \'hello!\'"); trace("new line \r\n hello!"); } - + public function testContinueLevels() { - var a = 5; + var a=5; loop123: switch (a) { - case 57 * a: + case 57 * a: trace("fiftyseven multiply a"); - var b = 0; + var b=0; while (b < 50) { if (b == 10) @@ -156,28 +156,28 @@ { break loop123; } - b = b + 1; + b=b + 1; } break; - case 13: + case 13: trace("thirteen"); - case 14: + case 14: trace("fourteen"); break; - case 89: + case 89: trace("eightynine"); break; - default: + default: trace("default clause"); } - - loop182: for (var c = 0; c < 8; c = c + 1) + + loop182: for (var c=0; c < 8; c=c + 1) { - - loop165: for (var d = 0; d < 25; d++) + + loop165: for (var d=0; d < 25; d++) { - - for (var e = 0; e < 50; e++) + + for (var e=0; e < 50; e++) { if (e == 9) { @@ -197,33 +197,33 @@ trace("hello"); } } - + public function testSwitchDefault() { - var a = 5; + var a=5; switch (a) { - case 57 * a: + case 57 * a: trace("fiftyseven multiply a"); break; - case 13: + case 13: trace("thirteen"); - case 14: + case 14: trace("fourteen"); break; - case 89: + case 89: trace("eightynine"); break; - default: + default: trace("default clause"); } } - + public function testMultipleCondition() { - var a = 5; - var b = 8; - var c = 9; + var a=5; + var b=8; + var c=9; if ((a <= 4 || b <= 8) && c == 7) { trace("onTrue"); @@ -233,10 +233,10 @@ trace("onFalse"); } } - + public function testForBreak() { - for (var a = 0; a < 10; a++) + for (var a=0; a < 10; a++) { if (a == 5) { @@ -245,19 +245,19 @@ trace("hello:" + a); } } - + public function testIf() { - var a = 5; + var a=5; if (a == 7) { trace("onTrue"); } } - + public function testIfElse() { - var a = 5; + var a=5; if (a == 7) { trace("onTrue"); @@ -267,18 +267,18 @@ trace("onFalse"); } } - + public function testFor() { - for (var a = 0; a < 10; a++) + for (var a=0; a < 10; a++) { trace("a=" + a); } } - + public function testForContinue() { - for (var a = 0; a < 10; a = a + 1) + for (var a=0; a < 10; a=a + 1) { if (a == 9) { @@ -302,11 +302,11 @@ trace("part5"); } } - + public function testTry() { var i:int; - i = 7; + i=7; try { trace("try body"); @@ -326,40 +326,40 @@ } trace("end"); } - + public function testSwitch() { - var a = 5; + var a=5; switch (a) { - case 57 * a: + case 57 * a: trace("fiftyseven multiply a"); break; - case 13: + case 13: trace("thirteen"); - case 14: + case 14: trace("fourteen"); break; - case 89: + case 89: trace("eightynine"); break; } } - + public function testTernarOperator() { - var a = 5; - var b = 4; - var c = 4; - var d = 78; - var e = (a == b) ? ((c == d) ? 1 : 7) : 3; + var a=5; + var b=4; + var c=4; + var d=78; + var e=(a == b) ? ((c == d) ? 1 : 7) : 3; trace("e=" + e); } - + public function testInnerIf() { - var a = 5; - var b = 4; + var a=5; + var b=4; if (a == 5) { if (b == 6) @@ -384,92 +384,92 @@ } trace("end"); } - + public function testVector() { - var v:Vector. = new Vector.(); + var v:Vector.=new Vector.(); v.push("hello"); - v[0] = "hi"; - v[5 * 8 - 39] = "hi2"; + v[0]="hi"; + v[5 * 8 - 39]="hi2"; trace(v[0]); } - + public function testProperty() { - var d = new TestClass1(); - var k = 7 + 8; + var d=new TestClass1(); + var k=7 + 8; if (k == 15) { d.method(d.attrib * 5); } } - + public function testRest(firstp:int, ... restval):int { trace("firstRest:" + restval[0]); return firstp; } - + public function testParamNames(firstp:int, secondp:int, thirdp:int):int { return firstp + secondp + thirdp; } - + public function testForEach() { var list:Array; - list = new Array(); - list[0] = "first"; - list[1] = "second"; - list[2] = "third"; + list=new Array(); + list[0]="first"; + list[1]="second"; + list[2]="third"; for each (var item in list) { trace("item #" + item); } } - + public function testForEachObjectArray() { var list:Array; - list = new Array(); - list[0] = "first"; - list[1] = "second"; - list[2] = "third"; + list=new Array(); + list[0]="first"; + list[1]="second"; + list[2]="third"; var test:Array; - test = new Array(); - test[0] = 0; - for each (test[0]in list) + test=new Array(); + test[0]=0; + for each (test[0] in list) { trace("item #" + test[0]); } } - + public function testForEachObjectAttribute() { var list:Array; - list = new Array(); - list[0] = "first"; - list[1] = "second"; - list[2] = "third"; + list=new Array(); + list[0]="first"; + list[1]="second"; + list[2]="third"; for each (testPriv in list) { trace("item #" + testPriv); } } - + public function testParamsCount(firstp:int, secondp:int, thirdp:int):int { return firstp; } - + public function testInlineFunctions() { - var first:String = "value1"; - var traceParameter:Function = function(aParam:String):String + 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 + var second:String="value2"; + second=second + "cc"; + var traceParam2:Function=function(bParam:String):String { trace(bParam + "," + aParam); return first + second + aParam + bParam; @@ -480,51 +480,51 @@ }; traceParameter("hello"); } - + public function testMissingDefault() { - var jj:int = 1; + var jj:int=1; switch (jj) { - case 1: - jj = 1; + case 1: + jj=1; break; - case 2: - jj = 2; + case 2: + jj=2; break; - default: - jj = 3; + default: + jj=3; } } - + private function traceIt(s:String) { trace(s); } - + private static var counter:int; - + private function getCounter():int { counter++; return counter; } - + public function testChainedAssignments() { var a:int; var b:int; var c:int; var d:int; - d = c = b = a = 5; - var e:TestClass2 = TestClass2.createMe("test"); - e.attrib1 = e.attrib2 = e.attrib3 = getCounter(); + d=c=b=a=5; + var e:TestClass2=TestClass2.createMe("test"); + e.attrib1=e.attrib2=e.attrib3=getCounter(); traceIt(e.toString()); } - + private function testFinallyZeroJump(param1:String):String { - var str:String = param1; + var str:String=param1; try { return str; @@ -546,13 +546,13 @@ } } } - + public function testInnerFunctions(a:String) { - var k:int = 5; + var k:int=5; if (k == 6) { - var s:int = 8; + var s:int=8; } function innerFunc(b:String) { @@ -560,7 +560,7 @@ } innerFunc(a); } - + public function testDeclarations() { var vall:*; @@ -570,17 +570,17 @@ var vclass:TestClass1; var vnumber:Number; var vobject:Object; - - vall = 6; - vstr = "hello"; - vuint = 7; - vint = -4; - vclass = new TestClass1(); - vnumber = 0.5; - vnumber = 6; - vobject = vclass; + + vall=6; + vstr="hello"; + vuint=7; + vint=-4; + vclass=new TestClass1(); + vnumber=0.5; + vnumber=6; + vobject=vclass; } - + public function testForIn() { var dic:Dictionary; @@ -594,258 +594,259 @@ trace(item); } } - + myInternal function namespacedFunc() { trace("hello"); } - + function unnamespacedFunc() { trace("hello2"); } - + function getNamespace():Namespace { return null; //myInternal; } - + function getName():String { return "unnamespacedFunc"; } - + function testNames() { - var ns = getNamespace(); - var name = getName(); + var ns=getNamespace(); + var name=getName(); //var a=ns::unnamespacedFunc(); //var b=ns::[name]; //trace(b.c); } - + function testComplexExpressions() { var i:int; var j:int; - j = (i = i + (i += i++)); + j=(i=i + (i+=i++)); } - + function testExpressions() { - var i:int = 5; - var j:int = 5; + var i:int=5; + var j:int=5; var arr:Array; - - if ((i = i /= 2) == 1 || i == 2) + + if ((i=i/=2) == 1 || i == 2) { arguments.concat(i); } else if (i == 0) { - i = j++; + i=j++; } else { arr[0](); } - + return i == 0; } - + public function testArguments(a:int):String { return arguments[0]; } - + public function println(str:String):void { trace(arguments.callee == this.println); trace(arguments.length); - trace(arguments[0]); + trace(arguments[0]); trace(str); } - + public function testLogicalComputing() { - var i = 5; - var j = 7; + var i=5; + var j=7; if (i > j) { - j = 9; - var b:Boolean = true; + j=9; + var b:Boolean=true; } - b = (i == 0 || i == 1) && j == 0; + b=(i == 0 || i == 1) && j == 0; } - + private function getInt():int { return counter++; } - + public function testInc2() { - var a = [1]; + var a=[1]; a[getInt()]++; - var d = a[getInt()]++; - - var e = ++a[getInt()]; - var b = 1; + var d=a[getInt()]++; + + var e=++a[getInt()]; + var b=1; b++; - var c = 1; - b = c++; + var c=1; + b=c++; } - + protected function testDecl2() { - var i:int = 5; - i += 7; + var i:int=5; + i+=7; if (i == 5) { if (i < 8) { - var k:int = 6; + var k:int=6; } } - k = 7; + k=7; } - + public function testChain2() { var g:Array; var h:Boolean; - var r:int = 7; - var t:int = 0; - t = this.getInt(); + var r:int=7; + var t:int=0; + t=this.getInt(); var extraLine:Boolean; if (t + 1 < g.length) { t++; - h = true; + h=true; } if (t >= 0) { trace("ch"); } - + } - + public function textXML() { - var name = "ahoj"; - var myXML:XML = - + var name="ahoj"; + var myXML:XML= {name} ; - - var k = myXML.@id; - var all = myXML.@*.toXMLString(); - k = myXML.book; - k = myXML.book.(@isbn = "12345"); - - var g:XML = new XML(""); + + var k=myXML.@id; + var all=myXML.@*.toXMLString(); + k=myXML.book; + k=myXML.book.(@isbn="12345"); + + var g:XML=new XML(""); } - + public function testDoWhile2():int { - var k:int = 5; + var k:int=5; do { k++; if (k == 7) { - k = 5 * k; + k=5 * k; } else { - k = 5 - k; + k=5 - k; } k-- } while (k < 9); return 2; } - + public function testWhileAnd() { - var a:int = 5; - var b:int = 10; + var a:int=5; + var b:int=10; while ((a < 10) && (b > 1)) { a++; b--; } - a = 7; - b = 9; + a=7; + b=9; } - + public function testNamedAnonFunctions() { var test=new function testFunc(param1:*, param2:int, param3:Array):Boolean - { - return (param1 as TestClass2).attrib1==5; - } + { + return (param1 as TestClass2).attrib1==5; + } } - + public function testStringConcat() { - var k:int = 8; - traceIt("hello"+5*6); - traceIt("hello"+(k-1)); - traceIt("hello"+5+6); + var k:int=8; + traceIt("hello" + 5 * 6); + traceIt("hello" + (k - 1)); + traceIt("hello" + 5 + 6); } - - public function testWhileTry() { - while(true) - { - try - { - while(true) - { - trace("a") - } - } - catch(e:EOFError) - { - continue; - } - catch(e:Error) - { - continue; - } - } - } - - public function testWhileTry2() - { - for(var i=0;i<100;i++) + + public function testWhileTry() { - try - { - for(var j=0;j<20;j++) - { - trace("a") - } - } - catch(e:EOFError) - { - continue; - } - catch(e:Error) - { - continue; - } - trace("after_try"); + while (true) + { + try + { + while (true) + { + trace("a") + } + } + catch (e:EOFError) + { + continue; + } + catch (e:Error) + { + continue; + } + } } - trace("end"); - } - public function testTryReturn() : int + + public function testWhileTry2() + { + for (var i=0; i < 100; i++) + { + try + { + for (var j=0; j < 20; j++) + { + trace("a") + } + } + catch (e:EOFError) + { + continue; + } + catch (e:Error) + { + continue; + } + trace("after_try"); + } + trace("end"); + } + + public function testTryReturn():int { try { - var i:int =0; - var b: Boolean = true; + var i:int=0; + var b:Boolean=true; if (i > 0) { while (testDoWhile2()) @@ -866,7 +867,11 @@ { } return 4; - + } - } -} \ No newline at end of file + + public function testOptionalParameters(p1:Event=null, p2:Number=1, p3:Number=-1, p4:Number=-1.1, p5:Number=-1.1, p6:String="a") + { + } + } +}