OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 function ID(x) { | 6 function ID(x) { |
7 return x; | 7 return x; |
8 } | 8 } |
9 | 9 |
10 | 10 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 var o = { | 291 var o = { |
292 get [throwMyError()]() { return 42; } | 292 get [throwMyError()]() { return 42; } |
293 }; | 293 }; |
294 }, MyError); | 294 }, MyError); |
295 assertThrows(function() { | 295 assertThrows(function() { |
296 var o = { | 296 var o = { |
297 set [throwMyError()](_) { } | 297 set [throwMyError()](_) { } |
298 }; | 298 }; |
299 }, MyError); | 299 }, MyError); |
300 })(); | 300 })(); |
| 301 |
| 302 |
| 303 (function TestNestedLiterals() { |
| 304 var array = [ |
| 305 42, |
| 306 { a: 'A', |
| 307 ['b']: 'B', |
| 308 c: 'C', |
| 309 [ID('d')]: 'D', |
| 310 }, |
| 311 43, |
| 312 ]; |
| 313 assertEquals(42, array[0]); |
| 314 assertEquals(43, array[2]); |
| 315 assertEquals('A', array[1].a); |
| 316 assertEquals('B', array[1].b); |
| 317 assertEquals('C', array[1].c); |
| 318 assertEquals('D', array[1].d); |
| 319 var object = { |
| 320 outer: 42, |
| 321 inner: { |
| 322 a: 'A', |
| 323 ['b']: 'B', |
| 324 c: 'C', |
| 325 [ID('d')]: 'D', |
| 326 }, |
| 327 outer2: 43, |
| 328 }; |
| 329 assertEquals(42, object.outer); |
| 330 assertEquals(43, object.outer2); |
| 331 assertEquals('A', object.inner.a); |
| 332 assertEquals('B', object.inner.b); |
| 333 assertEquals('C', object.inner.c); |
| 334 assertEquals('D', object.inner.d); |
| 335 var object = { |
| 336 outer: 42, |
| 337 array: [ |
| 338 43, |
| 339 { a: 'A', |
| 340 ['b']: 'B', |
| 341 c: 'C', |
| 342 [ID('d')]: 'D', |
| 343 }, |
| 344 44, |
| 345 ], |
| 346 outer2: 45 |
| 347 }; |
| 348 assertEquals(42, object.outer); |
| 349 assertEquals(45, object.outer2); |
| 350 assertEquals(43, object.array[0]); |
| 351 assertEquals(44, object.array[2]); |
| 352 assertEquals('A', object.array[1].a); |
| 353 assertEquals('B', object.array[1].b); |
| 354 assertEquals('C', object.array[1].c); |
| 355 assertEquals('D', object.array[1].d); |
| 356 })(); |
OLD | NEW |