| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 // Flags: --harmony-computed-property-names --harmony-classes | 7 // Flags: --harmony-computed-property-names --harmony-classes |
| 8 | 8 |
| 9 | 9 |
| 10 function ID(x) { | 10 function ID(x) { |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 *['constructor']() { | 381 *['constructor']() { |
| 382 yield 1; | 382 yield 1; |
| 383 yield 2; | 383 yield 2; |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 var iter = new C4().constructor(); | 386 var iter = new C4().constructor(); |
| 387 assertIteratorResult(1, false, iter.next()); | 387 assertIteratorResult(1, false, iter.next()); |
| 388 assertIteratorResult(2, false, iter.next()); | 388 assertIteratorResult(2, false, iter.next()); |
| 389 assertIteratorResult(undefined, true, iter.next()); | 389 assertIteratorResult(undefined, true, iter.next()); |
| 390 })(); | 390 })(); |
| 391 |
| 392 |
| 393 (function TestExceptionInName() { |
| 394 function MyError() {}; |
| 395 function throwMyError() { |
| 396 throw new MyError(); |
| 397 } |
| 398 assertThrows(function() { |
| 399 class C { |
| 400 [throwMyError()]() {} |
| 401 } |
| 402 }, MyError); |
| 403 assertThrows(function() { |
| 404 class C { |
| 405 get [throwMyError()]() { return 42; } |
| 406 } |
| 407 }, MyError); |
| 408 assertThrows(function() { |
| 409 class C { |
| 410 set [throwMyError()](_) { } |
| 411 } |
| 412 }, MyError); |
| 413 })(); |
| 414 |
| 415 |
| 416 (function TestTdzName() { |
| 417 assertThrows(function() { |
| 418 class C { |
| 419 [C]() {} |
| 420 } |
| 421 }, ReferenceError); |
| 422 assertThrows(function() { |
| 423 class C { |
| 424 get [C]() { return 42; } |
| 425 } |
| 426 }, ReferenceError); |
| 427 assertThrows(function() { |
| 428 class C { |
| 429 set [C](_) { } |
| 430 } |
| 431 }, ReferenceError); |
| 432 })(); |
| OLD | NEW |