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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/super.js
diff --git a/test/mjsunit/harmony/super.js b/test/mjsunit/harmony/super.js
index 809ba1071d71670dec0015709e07939987405fb6..2469181e9bbd07f8e661e06ab0043f384b7ab1c5 100644
--- a/test/mjsunit/harmony/super.js
+++ b/test/mjsunit/harmony/super.js
@@ -225,10 +225,58 @@
}());
+(function TestCountOperations() {
+ function Base() {}
+ Base.prototype = {
+ constructor: Base,
+ get x() {
+ return this._x;
+ },
+ set x(v) {
+ this._x = v;
+ },
+ _x: 1
+ };
+
+ function Derived() {}
+ Derived.__proto__ = Base;
+ Derived.prototype = {
+ __proto__: Base.prototype,
+ constructor: Derived,
+ _x: 2
+ };
+
+ Derived.prototype.testCounts = function() {
+ assertEquals(2, this._x);
+ assertEquals(2, super.x);
+ 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
+ assertEquals(3, super.x);
+ ++super.x;
+ assertEquals(4, super.x);
+ assertEquals(4, super.x++);
+ assertEquals(5, super.x);
+ assertEquals(6, ++super.x);
+ assertEquals(6, super.x);
+ assertEquals(6, this._x);
+
+ super.x--;
+ assertEquals(5, super.x);
+ --super.x;
+ assertEquals(4, super.x);
+ assertEquals(4, super.x--);
+ assertEquals(3, super.x);
+ assertEquals(2, --super.x);
+ assertEquals(2, super.x);
+ assertEquals(2, this._x);
+ }.toMethod(Derived.prototype);
+ new Derived().testCounts();
+}());
+
+
(function TestUnsupportedCases() {
function f1(x) { return super[x]; }
+ function f2(x) { super[x] = 5; }
var o = {}
assertThrows(function(){f1.toMethod(o)(x);}, ReferenceError);
- function f2() { super.x++; }
- assertThrows(function(){f2.toMethod(o)();}, ReferenceError);
+ assertThrows(function(){f2.toMethod(o)(x);}, ReferenceError);
}());
« 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