Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: test/mjsunit/es6/object-literals-method.js

Issue 1590873002: Make generators non-constructable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adapt test262.status Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/es6/generators-objects.js ('k') | test/mjsunit/harmony/reflect-construct.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })();
OLDNEW
« no previous file with comments | « test/mjsunit/es6/generators-objects.js ('k') | test/mjsunit/harmony/reflect-construct.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698