From fafa62f42e364b5778f2389b685a54e4082ead8c Mon Sep 17 00:00:00 2001 From: Markus Stefanko Date: Sun, 19 Nov 2017 00:03:10 +0700 Subject: [PATCH] Test cases for #314 --- test/issues/Issue314.as | 15 +++++++++++++++ test/issues/Issue314.hx | 17 +++++++++++++++++ test/unit/as3hx/AS3HXTest.hx | 5 +++++ 3 files changed, 37 insertions(+) create mode 100644 test/issues/Issue314.as create mode 100644 test/issues/Issue314.hx diff --git a/test/issues/Issue314.as b/test/issues/Issue314.as new file mode 100644 index 0000000..540e607 --- /dev/null +++ b/test/issues/Issue314.as @@ -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"; + } + } +} \ No newline at end of file diff --git a/test/issues/Issue314.hx b/test/issues/Issue314.hx new file mode 100644 index 0000000..25133df --- /dev/null +++ b/test/issues/Issue314.hx @@ -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"; + } +} diff --git a/test/unit/as3hx/AS3HXTest.hx b/test/unit/as3hx/AS3HXTest.hx index 1b03694..cbede7b 100644 --- a/test/unit/as3hx/AS3HXTest.hx +++ b/test/unit/as3hx/AS3HXTest.hx @@ -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';