| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 var obj = { | 28 var obj = { |
| 29 a: 7, | 29 a: 7, |
| 30 b: { x: 12, y: 24 }, | 30 b: { x: 12, y: 24 }, |
| 31 c: 'Zebra' | 31 c: 'Zebra' |
| 32 } | 32 }; |
| 33 | 33 |
| 34 assertEquals(7, obj.a); | 34 assertEquals(7, obj.a); |
| 35 assertEquals(12, obj.b.x); | 35 assertEquals(12, obj.b.x); |
| 36 assertEquals(24, obj.b.y); | 36 assertEquals(24, obj.b.y); |
| 37 assertEquals('Zebra', obj.c); | 37 assertEquals('Zebra', obj.c); |
| 38 | 38 |
| 39 var z = 24; | 39 var z = 24; |
| 40 | 40 |
| 41 var obj2 = { | 41 var obj2 = { |
| 42 a: 7, | 42 a: 7, |
| 43 b: { x: 12, y: z }, | 43 b: { x: 12, y: z }, |
| 44 c: 'Zebra' | 44 c: 'Zebra' |
| 45 } | 45 }; |
| 46 | 46 |
| 47 assertEquals(7, obj2.a); | 47 assertEquals(7, obj2.a); |
| 48 assertEquals(12, obj2.b.x); | 48 assertEquals(12, obj2.b.x); |
| 49 assertEquals(24, obj2.b.y); | 49 assertEquals(24, obj2.b.y); |
| 50 assertEquals('Zebra', obj2.c); | 50 assertEquals('Zebra', obj2.c); |
| 51 | 51 |
| 52 var arr = []; | 52 var arr = []; |
| 53 for (var i = 0; i < 2; i++) { | 53 for (var i = 0; i < 2; i++) { |
| 54 arr[i] = { | 54 arr[i] = { |
| 55 a: 7, | 55 a: 7, |
| 56 b: { x: 12, y: 24 }, | 56 b: { x: 12, y: 24 }, |
| 57 c: 'Zebra' | 57 c: 'Zebra' |
| 58 } | 58 }; |
| 59 } | 59 } |
| 60 | 60 |
| 61 arr[0].b.x = 2; | 61 arr[0].b.x = 2; |
| 62 assertEquals(2, arr[0].b.x); | 62 assertEquals(2, arr[0].b.x); |
| 63 assertEquals(12, arr[1].b.x); | 63 assertEquals(12, arr[1].b.x); |
| 64 | 64 |
| 65 | 65 |
| 66 function makeSparseArray() { | 66 function makeSparseArray() { |
| 67 return { | 67 return { |
| 68 '0': { x: 12, y: 24 }, | 68 '0': { x: 12, y: 24 }, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 function construct() { this.constructed = true; } | 183 function construct() { this.constructed = true; } |
| 184 var v = eval("({" + keyword + ": construct})"); | 184 var v = eval("({" + keyword + ": construct})"); |
| 185 var vo = eval("new v." + keyword + "()"); | 185 var vo = eval("new v." + keyword + "()"); |
| 186 assertTrue(vo instanceof construct); | 186 assertTrue(vo instanceof construct); |
| 187 assertTrue(vo.constructed); | 187 assertTrue(vo.constructed); |
| 188 } | 188 } |
| 189 | 189 |
| 190 for (var i = 0; i < keywords.length; i++) { | 190 for (var i = 0; i < keywords.length; i++) { |
| 191 testKeywordProperty(keywords[i]); | 191 testKeywordProperty(keywords[i]); |
| 192 } | 192 } |
| OLD | NEW |