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

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

Issue 896643003: Class methods should be non enumerable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use LanguageMode Created 5 years, 10 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/x87/full-codegen-x87.cc ('k') | test/mjsunit/harmony/computed-property-names-classes.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: --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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 assertEquals('class D { constructor() { 42; } }', D.toString()); 179 assertEquals('class D { constructor() { 42; } }', D.toString());
180 180
181 class E { x() { 42; } } 181 class E { x() { 42; } }
182 assertEquals('class E { x() { 42; } }', E.toString()); 182 assertEquals('class E { x() { 42; } }', E.toString());
183 })(); 183 })();
184 184
185 185
186 function assertMethodDescriptor(object, name) { 186 function assertMethodDescriptor(object, name) {
187 var descr = Object.getOwnPropertyDescriptor(object, name); 187 var descr = Object.getOwnPropertyDescriptor(object, name);
188 assertTrue(descr.configurable); 188 assertTrue(descr.configurable);
189 assertTrue(descr.enumerable); 189 assertFalse(descr.enumerable);
190 assertTrue(descr.writable); 190 assertTrue(descr.writable);
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 assertTrue(descr.enumerable); 199 assertFalse(descr.enumerable);
200 assertEquals('function', typeof descr.get); 200 assertEquals('function', typeof descr.get);
201 assertEquals(undefined, descr.set); 201 assertEquals(undefined, descr.set);
202 } 202 }
203 203
204 204
205 function assertSetterDescriptor(object, name) { 205 function assertSetterDescriptor(object, name) {
206 var descr = Object.getOwnPropertyDescriptor(object, name); 206 var descr = Object.getOwnPropertyDescriptor(object, name);
207 assertTrue(descr.configurable); 207 assertTrue(descr.configurable);
208 assertTrue(descr.enumerable); 208 assertFalse(descr.enumerable);
209 assertEquals(undefined, descr.get); 209 assertEquals(undefined, descr.get);
210 assertEquals('function', typeof descr.set); 210 assertEquals('function', typeof descr.set);
211 } 211 }
212 212
213 213
214 function assertAccessorDescriptor(object, name) { 214 function assertAccessorDescriptor(object, name) {
215 var descr = Object.getOwnPropertyDescriptor(object, name); 215 var descr = Object.getOwnPropertyDescriptor(object, name);
216 assertTrue(descr.configurable); 216 assertTrue(descr.configurable);
217 assertTrue(descr.enumerable); 217 assertFalse(descr.enumerable);
218 assertEquals('function', typeof descr.get); 218 assertEquals('function', typeof descr.get);
219 assertEquals('function', typeof descr.set); 219 assertEquals('function', typeof descr.set);
220 } 220 }
221 221
222 222
223 (function TestMethods() { 223 (function TestMethods() {
224 class C { 224 class C {
225 method() { return 1; } 225 method() { return 1; }
226 static staticMethod() { return 2; } 226 static staticMethod() { return 2; }
227 method2() { return 3; } 227 method2() { return 3; }
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 } 870 }
871 }; 871 };
872 new C3(); 872 new C3();
873 873
874 class C4 extends Object { 874 class C4 extends Object {
875 constructor() { 875 constructor() {
876 super(new super()); 876 super(new super());
877 } 877 }
878 }; new C4(); 878 }; new C4();
879 }()); 879 }());
OLDNEW
« no previous file with comments | « src/x87/full-codegen-x87.cc ('k') | test/mjsunit/harmony/computed-property-names-classes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698