diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-07-20 18:28:49 +0200 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-07-20 18:28:49 +0200 |
commit | decf2ae400d52e98bcd073a69b24b3dbf3d38d53 (patch) | |
tree | 06ec1f9ecaebbfe25927beb577121365abe450ed /test | |
parent | 0d989011fffd768116d0ca81f6c067c7e0876f36 (diff) |
[swfinterp] Correct array access
Diffstat (limited to 'test')
-rw-r--r-- | test/swftests/ArrayAccess.as | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/swftests/ArrayAccess.as b/test/swftests/ArrayAccess.as new file mode 100644 index 000000000..e22caa386 --- /dev/null +++ b/test/swftests/ArrayAccess.as @@ -0,0 +1,19 @@ +// input: [["a", "b", "c", "d"]] +// output: ["c", "b", "a", "d"] + +package { +public class ArrayAccess { + public static function main(ar:Array):Array { + var aa:ArrayAccess = new ArrayAccess(); + return aa.f(ar, 2); + } + + private function f(ar:Array, num:Number):Array{ + var x:String = ar[0]; + var y:String = ar[num % ar.length]; + ar[0] = y; + ar[num] = x; + return ar; + } +} +} |