Skip to content

Commit

Permalink
Test cases for #314
Browse files Browse the repository at this point in the history
  • Loading branch information
mastef authored and SlavaRa committed Nov 18, 2017
1 parent 21770a3 commit fafa62f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/issues/Issue314.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package {
public class Issue303 {
public function Issue303() {}
public function hide1(param1:*) : *
{
this[param1] = false;
this[param1].visible = false;
}
public function hide2(param1:*) : *
{
this[param1] = "nothing";
this[param1].collision.currentObject = "nothing";
}
}
}
17 changes: 17 additions & 0 deletions test/issues/Issue314.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

class Issue303
{
public function new()
{
}
public function hide1(param1 : Dynamic) : Dynamic
{
Reflect.setField(this, Std.string(param1), false);
Reflect.field(this, Std.string(param1)).visible = false;
}
public function hide2(param1 : Dynamic) : Dynamic
{
Reflect.setField(this, Std.string(param1), "nothing");
Reflect.field(this, Std.string(param1)).collision.currentObject = "nothing";
}
}
5 changes: 5 additions & 0 deletions test/unit/as3hx/AS3HXTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,11 @@ class AS3HXTest {
generate("Issue303.as", "Issue303.hx");
}

@Test("this[param1].something = false")
public function issue314() {
generate("Issue314.as", "Issue314.hx");
}

function generate(as3FileName:String, expectedHaxeFileName:String) {
var issuesDirectory = FileSystem.absolutePath("test/issues");
var generatedDirectoryPath = '$issuesDirectory/generated';
Expand Down

0 comments on commit fafa62f

Please sign in to comment.