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

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

Issue 639123009: Classes: Add basic support for properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use define data property instead Created 6 years, 2 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 | Annotate | Revision Log
« src/ia32/full-codegen-ia32.cc ('K') | « src/ia32/full-codegen-ia32.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 5 // Flags: --harmony
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 assertEquals(1, x); 238 assertEquals(1, x);
239 assertEquals(2, C.staticX = 2); 239 assertEquals(2, C.staticX = 2);
240 assertEquals(2, staticX); 240 assertEquals(2, staticX);
241 assertEquals(3, new C().y = 3); 241 assertEquals(3, new C().y = 3);
242 assertEquals(3, y); 242 assertEquals(3, y);
243 assertEquals(4, C.staticY = 4); 243 assertEquals(4, C.staticY = 4);
244 assertEquals(4, staticY); 244 assertEquals(4, staticY);
245 })(); 245 })();
246 246
247 247
248 (function TestSideEffectsInPropertyDefine() {
249 function B() {}
250 B.prototype = {
251 constructor: B,
252 set m(v) {
253 throw Error();
254 }
255 };
256
257 class C extends B {
258 m() { return 1; }
259 }
260
261 assertEquals(1, new C().m());
262 })();
263
264
248 (function TestAccessors() { 265 (function TestAccessors() {
249 class C { 266 class C {
250 // constructor(x) { 267 // constructor(x) {
251 // this._x = x; 268 // this._x = x;
252 // } 269 // }
253 270
254 get x() { return this._x; } 271 get x() { return this._x; }
255 set x(v) { this._x = v; } 272 set x(v) { this._x = v; }
256 273
257 // static get staticX() { return this._x; } 274 // static get staticX() { return this._x; }
258 // static set staticX(v) { this._x = v; } 275 // static set staticX(v) { this._x = v; }
259 } 276 }
260 277
261 // assertTrue(C.prototype.hasOwnProperty('x')); 278 // assertTrue(C.prototype.hasOwnProperty('x'));
262 // assertTrue(C.hasOwnProperty('staticX')); 279 // assertTrue(C.hasOwnProperty('staticX'));
263 280
264 // var c = new C(1); 281 // var c = new C(1);
265 // c._x = 1; 282 // c._x = 1;
266 // assertEquals(1, c.x); 283 // assertEquals(1, c.x);
267 284
268 })(); 285 })();
OLDNEW
« src/ia32/full-codegen-ia32.cc ('K') | « src/ia32/full-codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698