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

Unified Diff: test/mjsunit/harmony/super.js

Issue 639243003: Support for super assignments in for..in. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback 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 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 d1cba533d56f9c3dbee417572808f12b66f8021a..50f03d44e4ac2771939453ffd847cc73e074f304 100644
--- a/test/mjsunit/harmony/super.js
+++ b/test/mjsunit/harmony/super.js
@@ -660,6 +660,66 @@
}());
+(function TestSetterInForIn() {
+ var setCalled = 0;
+ var getCalled = 0;
+ function Base() {}
+ Base.prototype = {
+ constructor: Base,
+ get x() {
+ getCalled++;
+ return 1;
+ },
+ set x(v) {
+ setCalled++;
+ this.x_.push(v);
+ },
+ };
+
+ function Derived() {
+ this.x_ = [];
+ }
+ Derived.prototype = {
+ __proto__: Base.prototype,
+ constructor: Derived,
+ };
+
+ Derived.prototype.testIter = function() {
+ setCalled = 0;
+ getCalled = 0;
+ for (super.x in [1,2,3]) {}
+ assertEquals(0, getCalled);
+ assertEquals(3, setCalled);
+ assertEquals(["0","1","2"], this.x_);
+ }.toMethod(Derived.prototype);
+
+ new Derived().testIter();
+
+ var x = 'x';
+ Derived.prototype.testIterKeyed = function() {
+ setCalled = 0;
+ getCalled = 0;
+ for (super[x] in [1,2,3]) {}
+ assertEquals(0, getCalled);
+ assertEquals(3, setCalled);
+ assertEquals(["0","1","2"], this.x_);
+
+ this.x_ = [];
+ setCalled = 0;
+ getCalled = 0;
+ var toStringCalled = 0;
+ var o = {toString: function () { toStringCalled++; return x }};
+ for (super[o] in [1,2,3]) {}
+ assertEquals(0, getCalled);
+ assertEquals(3, setCalled);
+ assertEquals(3, toStringCalled);
+ assertEquals(["0","1","2"], this.x_);
+ }.toMethod(Derived.prototype);
+
+ new Derived().testIterKeyed();
+}());
+
+
(function TestKeyedSetterCreatingOwnProperties() {
var ownReadOnly = 'ownReadOnly';
var ownReadonlyAccessor = 'ownReadonlyAccessor';
« 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