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 // Flags: --harmony-classes --harmony-sloppy | 5 // Flags: --harmony-classes --harmony-sloppy |
6 | 6 |
7 (function TestBasics() { | 7 (function TestBasics() { |
8 var C = class C {} | 8 var C = class C {} |
9 assertEquals(typeof C, 'function'); | 9 assertEquals(typeof C, 'function'); |
10 assertEquals(C.__proto__, Function.prototype); | 10 assertEquals(C.__proto__, Function.prototype); |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 assertThrows(function() { | 798 assertThrows(function() { |
799 class C { | 799 class C { |
800 constructor() { | 800 constructor() { |
801 super(this); | 801 super(this); |
802 } | 802 } |
803 }; new C(); | 803 }; new C(); |
804 }, TypeError); | 804 }, TypeError); |
805 assertThrows(function() { | 805 assertThrows(function() { |
806 class C { | 806 class C { |
807 constructor() { | 807 constructor() { |
| 808 super.method(); |
| 809 super(this); |
| 810 } |
| 811 }; new C(); |
| 812 }, TypeError); |
| 813 assertThrows(function() { |
| 814 class C { |
| 815 constructor() { |
| 816 super(super.method()); |
| 817 } |
| 818 }; new C(); |
| 819 }, TypeError); |
| 820 assertThrows(function() { |
| 821 class C { |
| 822 constructor() { |
| 823 super(super()); |
| 824 } |
| 825 }; new C(); |
| 826 }, TypeError); |
| 827 assertThrows(function() { |
| 828 class C { |
| 829 constructor() { |
808 super(1, 2, Object.getPrototypeOf(this)); | 830 super(1, 2, Object.getPrototypeOf(this)); |
809 } | 831 } |
810 }; new C(); | 832 }; new C(); |
811 }, TypeError); | 833 }, TypeError); |
812 assertThrows(function() { | 834 assertThrows(function() { |
813 class C { | 835 class C { |
814 constructor() { | 836 constructor() { |
815 { super(1, 2); } | 837 { super(1, 2); } |
816 } | 838 } |
817 }; new C(); | 839 }; new C(); |
(...skipping 23 matching lines...) Expand all Loading... |
841 new C2(); | 863 new C2(); |
842 | 864 |
843 class C3 extends Object { | 865 class C3 extends Object { |
844 constructor() { | 866 constructor() { |
845 ; 'use strict';;;;; | 867 ; 'use strict';;;;; |
846 // This is a comment. | 868 // This is a comment. |
847 super(); | 869 super(); |
848 } | 870 } |
849 }; | 871 }; |
850 new C3(); | 872 new C3(); |
| 873 |
| 874 class C4 extends Object { |
| 875 constructor() { |
| 876 super(new super()); |
| 877 } |
| 878 }; new C4(); |
851 }()); | 879 }()); |
OLD | NEW |