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: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 | 7 |
8 (function TestBasics() { | 8 (function TestBasics() { |
9 var object = { | 9 var object = { |
10 method() { | 10 method() { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 (function TestGeneratorProto() { | 232 (function TestGeneratorProto() { |
233 var object = { | 233 var object = { |
234 *method() {} | 234 *method() {} |
235 }; | 235 }; |
236 | 236 |
237 assertEquals(GeneratorFunction.prototype, | 237 assertEquals(GeneratorFunction.prototype, |
238 Object.getPrototypeOf(object.method)); | 238 Object.getPrototypeOf(object.method)); |
239 })(); | 239 })(); |
240 | 240 |
241 | 241 |
242 (function TestGeneratorConstructable() { | 242 (function TestGeneratorNotConstructable() { |
243 var object = { | 243 var object = { |
244 *method() { | 244 *method() { |
245 yield 1; | 245 yield 1; |
246 } | 246 } |
247 }; | 247 }; |
248 | 248 |
249 var g = new object.method(); | 249 assertThrows(()=>new object.method()); |
250 assertIteratorResult(1, false, g.next()); | |
251 assertIteratorResult(undefined, true, g.next()); | |
252 })(); | 250 })(); |
253 | 251 |
254 | 252 |
255 (function TestGeneratorName() { | 253 (function TestGeneratorName() { |
256 var object = { | 254 var object = { |
257 *method() {}, | 255 *method() {}, |
258 *1() {}, | 256 *1() {}, |
259 *2.0() {} | 257 *2.0() {} |
260 }; | 258 }; |
261 var f = object.method; | 259 var f = object.method; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 var p = {}; | 303 var p = {}; |
306 var object = { | 304 var object = { |
307 __proto__() { | 305 __proto__() { |
308 return 1; | 306 return 1; |
309 }, | 307 }, |
310 __proto__: p | 308 __proto__: p |
311 }; | 309 }; |
312 assertEquals(p, Object.getPrototypeOf(object)); | 310 assertEquals(p, Object.getPrototypeOf(object)); |
313 assertEquals(1, object.__proto__()); | 311 assertEquals(1, object.__proto__()); |
314 })(); | 312 })(); |
OLD | NEW |