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

Unified Diff: test/mjsunit/harmony/object-rest-basic.js

Issue 2639333004: [pattern rewriter] Only desugar to call %ToName on computed properties (Closed)
Patch Set: add dcheck Created 3 years, 11 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/runtime/runtime-object.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/object-rest-basic.js
diff --git a/test/mjsunit/harmony/object-rest-basic.js b/test/mjsunit/harmony/object-rest-basic.js
index 4c9b564ca7c0ac7d9072261adc8f6f034e47bcef..f03eccdc16552089953ad813686ffdabad5a4d33 100644
--- a/test/mjsunit/harmony/object-rest-basic.js
+++ b/test/mjsunit/harmony/object-rest-basic.js
@@ -42,6 +42,11 @@ assertEquals({ a: 1 }, x);
assertEquals(key, 2);
assertEquals(1, y);
+var key = '1';
+var {[key]: y, ...x} = {1: 1, a: 1};
+assertEquals({a: 1}, x);
+assertEquals(1, y);
+
function example({a, ...rest}, { b = rest }) {
assertEquals(1, a);
assertEquals({ b: 2, c: 3}, rest);
@@ -56,6 +61,13 @@ var y = {
};
assertEquals(y.a, 3);
+var {...y} = {
+ get a() {
+ return 1
+ }
+};
+assertEquals({a: 1}, y);
+
var x = {
get a() { throw new Error(); },
};
@@ -120,3 +132,28 @@ assertEquals({ 0: { x: 1} }, z);
var {...{x}} = { x: 1};
assertEquals(1, x);
+
+var {4294967297: y, ...x} = {4294967297: 1, x: 1};
+assertEquals(1, y);
+assertEquals({x: 1}, x);
+
+var obj = {
+ [Symbol.toPrimitive]() {
+ return 1;
+ }
+};
+var {[obj]: y, ...x} = {1: 1, x: 1};
+assertEquals(1, y);
+assertEquals({x: 1}, x);
+
+var {[null]: y, ...x} = {null: 1, x: 1};
+assertEquals(1, y);
+assertEquals({x: 1}, x);
+
+var {[true]: y, ...x} = {true: 1, x: 1};
+assertEquals(1, y);
+assertEquals({x: 1}, x);
+
+var {[false]: y, ...x} = {false: 1, x: 1};
+assertEquals(1, y);
+assertEquals({x: 1}, x);
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698