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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 assertEquals('function', typeof descr.value); | 191 assertEquals('function', typeof descr.value); |
192 assertFalse('prototype' in descr.value); | 192 assertFalse('prototype' in descr.value); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 function assertGetterDescriptor(object, name) { | 196 function assertGetterDescriptor(object, name) { |
197 var descr = Object.getOwnPropertyDescriptor(object, name); | 197 var descr = Object.getOwnPropertyDescriptor(object, name); |
198 assertTrue(descr.configurable); | 198 assertTrue(descr.configurable); |
199 assertFalse(descr.enumerable); | 199 assertFalse(descr.enumerable); |
200 assertEquals('function', typeof descr.get); | 200 assertEquals('function', typeof descr.get); |
| 201 assertFalse('prototype' in descr.get); |
201 assertEquals(undefined, descr.set); | 202 assertEquals(undefined, descr.set); |
202 } | 203 } |
203 | 204 |
204 | 205 |
205 function assertSetterDescriptor(object, name) { | 206 function assertSetterDescriptor(object, name) { |
206 var descr = Object.getOwnPropertyDescriptor(object, name); | 207 var descr = Object.getOwnPropertyDescriptor(object, name); |
207 assertTrue(descr.configurable); | 208 assertTrue(descr.configurable); |
208 assertFalse(descr.enumerable); | 209 assertFalse(descr.enumerable); |
209 assertEquals(undefined, descr.get); | 210 assertEquals(undefined, descr.get); |
210 assertEquals('function', typeof descr.set); | 211 assertEquals('function', typeof descr.set); |
| 212 assertFalse('prototype' in descr.set); |
211 } | 213 } |
212 | 214 |
213 | 215 |
214 function assertAccessorDescriptor(object, name) { | 216 function assertAccessorDescriptor(object, name) { |
215 var descr = Object.getOwnPropertyDescriptor(object, name); | 217 var descr = Object.getOwnPropertyDescriptor(object, name); |
216 assertTrue(descr.configurable); | 218 assertTrue(descr.configurable); |
217 assertFalse(descr.enumerable); | 219 assertFalse(descr.enumerable); |
218 assertEquals('function', typeof descr.get); | 220 assertEquals('function', typeof descr.get); |
219 assertEquals('function', typeof descr.set); | 221 assertEquals('function', typeof descr.set); |
| 222 assertFalse('prototype' in descr.get); |
| 223 assertFalse('prototype' in descr.set); |
220 } | 224 } |
221 | 225 |
222 | 226 |
223 (function TestMethods() { | 227 (function TestMethods() { |
224 class C { | 228 class C { |
225 method() { return 1; } | 229 method() { return 1; } |
226 static staticMethod() { return 2; } | 230 static staticMethod() { return 2; } |
227 method2() { return 3; } | 231 method2() { return 3; } |
228 static staticMethod2() { return 4; } | 232 static staticMethod2() { return 4; } |
229 } | 233 } |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 } | 874 } |
871 }; | 875 }; |
872 new C3(); | 876 new C3(); |
873 | 877 |
874 class C4 extends Object { | 878 class C4 extends Object { |
875 constructor() { | 879 constructor() { |
876 super(new super()); | 880 super(new super()); |
877 } | 881 } |
878 }; new C4(); | 882 }; new C4(); |
879 }()); | 883 }()); |
OLD | NEW |