diff --git a/src/as3hx/Writer.hx b/src/as3hx/Writer.hx index b0e27b2..f60d67d 100644 --- a/src/as3hx/Writer.hx +++ b/src/as3hx/Writer.hx @@ -1886,8 +1886,9 @@ class Writer if (conds[0].match(EBinop("&&" | "||", _, _, _))) return true; //index must be incremented by 1 if (incrs.length == 1) { - return switch (incrs[0]) { + return switch(incrs[0]) { case EUnop(op, _, _): op != "++"; + case EBinop(openb,_,_,_): true; default: false; } } diff --git a/src/as3hx/parsers/TypeParser.hx b/src/as3hx/parsers/TypeParser.hx index 67f90af..07ff540 100644 --- a/src/as3hx/parsers/TypeParser.hx +++ b/src/as3hx/parsers/TypeParser.hx @@ -51,8 +51,8 @@ class TypeParser { case TDot: tk = tokenizer.token(); switch(ParserUtils.uncomment(tk)) { - case TId(id): a.push(id); - default: ParserUtils.unexpected(ParserUtils.uncomment(tk)); + case TId(id): a.push(id); + default: ParserUtils.unexpected(ParserUtils.uncomment(tk)); } case TCommented(s,b,t): diff --git a/test/issues/Issue178.as b/test/issues/Issue178.as new file mode 100644 index 0000000..52212da --- /dev/null +++ b/test/issues/Issue178.as @@ -0,0 +1,9 @@ +package { + public class Issue178 { + public function Issue178() { + for (var i:int = 0; i < 10; i+=2) { + trace(i); + } + } + } +} \ No newline at end of file diff --git a/test/issues/Issue178.hx b/test/issues/Issue178.hx new file mode 100644 index 0000000..7d6b029 --- /dev/null +++ b/test/issues/Issue178.hx @@ -0,0 +1,13 @@ + +class Issue178 +{ + public function new() + { + var i : Int = 0; + while (i < 10) + { + trace(i); + i += 2; + } + } +} diff --git a/test/unit/as3hx/AS3HXTest.hx b/test/unit/as3hx/AS3HXTest.hx index 1c53651..9d1e348 100644 --- a/test/unit/as3hx/AS3HXTest.hx +++ b/test/unit/as3hx/AS3HXTest.hx @@ -298,6 +298,11 @@ class AS3HXTest { generate("Issue176.as", "Issue176.hx"); } + @Test + public function issue178() { + generate("Issue178.as", "Issue178.hx"); + } + function generate(as3FileName:String, expectedHaxeFileName:String) { var issuesDirectory = FileSystem.absolutePath("test/issues"); var generatedDirectoryPath = '$issuesDirectory/generated';