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

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

Issue 613673002: Support count operations on super named properties. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Platform ports 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
« no previous file with comments | « src/x64/full-codegen-x64.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 5 // Flags: --harmony-classes
6 6
7 7
8 (function TestSuperNamedLoads() { 8 (function TestSuperNamedLoads() {
9 function Base() { } 9 function Base() { }
10 function Derived() { 10 function Derived() {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 }.toMethod(Derived.prototype); 218 }.toMethod(Derived.prototype);
219 var d = new Derived(); 219 var d = new Derived();
220 d.mSloppy(); 220 d.mSloppy();
221 assertEquals(undefined, d.x); 221 assertEquals(undefined, d.x);
222 var d1 = new Derived(); 222 var d1 = new Derived();
223 assertThrows(function() { d.mStrict(); }, ReferenceError); 223 assertThrows(function() { d.mStrict(); }, ReferenceError);
224 assertEquals(undefined, d.x); 224 assertEquals(undefined, d.x);
225 }()); 225 }());
226 226
227 227
228 (function TestCountOperations() {
229 function Base() {}
230 Base.prototype = {
231 constructor: Base,
232 get x() {
233 return this._x;
234 },
235 set x(v) {
236 this._x = v;
237 },
238 _x: 1
239 };
240
241 function Derived() {}
242 Derived.__proto__ = Base;
243 Derived.prototype = {
244 __proto__: Base.prototype,
245 constructor: Derived,
246 _x: 2
247 };
248
249 Derived.prototype.testCounts = function() {
250 assertEquals(2, this._x);
251 assertEquals(2, super.x);
252 super.x++;
arv (Not doing code reviews) 2014/09/29 14:50:29 Maybe wrap these in assertEquals to also assert th
Dmitry Lomov (no reviews) 2014/09/29 14:54:45 No, these count operations without use of return v
253 assertEquals(3, super.x);
254 ++super.x;
255 assertEquals(4, super.x);
256 assertEquals(4, super.x++);
257 assertEquals(5, super.x);
258 assertEquals(6, ++super.x);
259 assertEquals(6, super.x);
260 assertEquals(6, this._x);
261
262 super.x--;
263 assertEquals(5, super.x);
264 --super.x;
265 assertEquals(4, super.x);
266 assertEquals(4, super.x--);
267 assertEquals(3, super.x);
268 assertEquals(2, --super.x);
269 assertEquals(2, super.x);
270 assertEquals(2, this._x);
271 }.toMethod(Derived.prototype);
272 new Derived().testCounts();
273 }());
274
275
228 (function TestUnsupportedCases() { 276 (function TestUnsupportedCases() {
229 function f1(x) { return super[x]; } 277 function f1(x) { return super[x]; }
278 function f2(x) { super[x] = 5; }
230 var o = {} 279 var o = {}
231 assertThrows(function(){f1.toMethod(o)(x);}, ReferenceError); 280 assertThrows(function(){f1.toMethod(o)(x);}, ReferenceError);
232 function f2() { super.x++; } 281 assertThrows(function(){f2.toMethod(o)(x);}, ReferenceError);
233 assertThrows(function(){f2.toMethod(o)();}, ReferenceError);
234 }()); 282 }());
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698