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

Side by Side Diff: test/mjsunit/harmony/classes.js

Issue 1101543002: [es6] Class extends may not be a generator function (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « src/runtime/runtime-classes.cc ('k') | no next file » | 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: --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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 assertThrows(function() { 64 assertThrows(function() {
65 // Function but its .prototype is not null or a function. 65 // Function but its .prototype is not null or a function.
66 class C extends Math.abs {} 66 class C extends Math.abs {}
67 }, TypeError); 67 }, TypeError);
68 68
69 assertThrows(function() { 69 assertThrows(function() {
70 Math.abs.prototype = 42; 70 Math.abs.prototype = 42;
71 class C extends Math.abs {} 71 class C extends Math.abs {}
72 }, TypeError); 72 }, TypeError);
73 delete Math.abs.prototype; 73 delete Math.abs.prototype;
74
75 assertThrows(function() {
76 function* g() {}
77 class C extends g {}
78 }, TypeError);
74 })(); 79 })();
75 80
76 81
77 (function TestConstructorProperty() { 82 (function TestConstructorProperty() {
78 class C {} 83 class C {}
79 assertEquals(C, C.prototype.constructor); 84 assertEquals(C, C.prototype.constructor);
80 var descr = Object.getOwnPropertyDescriptor(C.prototype, 'constructor'); 85 var descr = Object.getOwnPropertyDescriptor(C.prototype, 'constructor');
81 assertTrue(descr.configurable); 86 assertTrue(descr.configurable);
82 assertFalse(descr.enumerable); 87 assertFalse(descr.enumerable);
83 assertTrue(descr.writable); 88 assertTrue(descr.writable);
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 testClassRestrictedProperties(ClassWithDefaultConstructor); 939 testClassRestrictedProperties(ClassWithDefaultConstructor);
935 testClassRestrictedProperties(Class); 940 testClassRestrictedProperties(Class);
936 testClassRestrictedProperties(DerivedClassWithDefaultConstructor); 941 testClassRestrictedProperties(DerivedClassWithDefaultConstructor);
937 testClassRestrictedProperties(DerivedClass); 942 testClassRestrictedProperties(DerivedClass);
938 testClassRestrictedProperties(class { method() {} }); 943 testClassRestrictedProperties(class { method() {} });
939 testClassRestrictedProperties(class { constructor() {} method() {} }); 944 testClassRestrictedProperties(class { constructor() {} method() {} });
940 testClassRestrictedProperties(class extends Class { }); 945 testClassRestrictedProperties(class extends Class { });
941 testClassRestrictedProperties( 946 testClassRestrictedProperties(
942 class extends Class { constructor() { super(); } }); 947 class extends Class { constructor() { super(); } });
943 })(); 948 })();
OLDNEW
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698