author | hannesw |
Fri, 03 May 2013 22:48:53 +0200 | |
changeset 17521 | 0522325da5ef |
parent 16531 | 8f1b0de50d07 |
child 24778 | 2ff5d7041566 |
permissions | -rw-r--r-- |
16147 | 1 |
/* |
16151 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
16147 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* NASHORN-258 : Broken slot assignments to non constant members of multidimensional arrays in OP= |
|
26 |
* |
|
27 |
* @test |
|
28 |
* @run |
|
29 |
*/ |
|
30 |
||
31 |
function test3(a) { |
|
16531
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
32 |
for (i = 0; i < a.length ; i++) { |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
33 |
for (j = 0; j < a[i].length ; j++) { |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
34 |
for (k = 0; k < a[i][j].length ; k++) { |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
35 |
a[i][j][k] *= 8; |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
36 |
} |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
37 |
} |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
38 |
} |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
39 |
} |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
40 |
|
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
41 |
function test3local(a) { |
16147 | 42 |
for (var i = 0; i < a.length ; i++) { |
43 |
for (var j = 0; j < a[i].length ; j++) { |
|
44 |
for (var k = 0; k < a[i][j].length ; k++) { |
|
45 |
a[i][j][k] *= 8; |
|
46 |
} |
|
47 |
} |
|
48 |
} |
|
49 |
} |
|
50 |
||
51 |
var array = [ [[1,1,1],[1,1,1],[1,1,1]], |
|
52 |
[[1,1,1],[1,1,1],[1,1,1]], |
|
53 |
[[1,1,1],[1,1,1],[1,1,1]] ]; |
|
54 |
||
55 |
test3(array); |
|
56 |
print(array); |
|
57 |
||
16531
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
58 |
test3local(array); |
8f1b0de50d07
8017010: index evaluation to a temporary location for index operator much change temporaries to slots, but never scoped vars
lagergren
parents:
16151
diff
changeset
|
59 |
print(array); |
16147 | 60 |
|
61 |
function outer() { |
|
62 |
||
63 |
var array2 = [ [[1,1,1],[1,1,1],[1,1,1]], |
|
64 |
[[1,1,1],[1,1,1],[1,1,1]], |
|
65 |
[[1,1,1],[1,1,1],[1,1,1]] ]; |
|
66 |
||
67 |
var f = function inner() { |
|
68 |
for (var i = 0; i < array2.length ; i++) { |
|
69 |
for (var j = 0; j < array2[i].length ; j++) { |
|
70 |
array2[i][j][2] *= 8; |
|
71 |
} |
|
72 |
} |
|
73 |
}; |
|
74 |
||
75 |
f(); |
|
76 |
print(array2); |
|
77 |
} |
|
78 |
||
79 |
outer(); |