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

Unified Diff: test/mjsunit/harmony/class-privates-evaluation-order.js

Issue 2329703002: Private fields
Patch Set: some comments Created 4 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 | « test/mjsunit/harmony/class-privates-errors.js ('k') | test/mjsunit/harmony/class-privates-proxy.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/class-privates-evaluation-order.js
diff --git a/test/mjsunit/harmony/class-privates-evaluation-order.js b/test/mjsunit/harmony/class-privates-evaluation-order.js
new file mode 100644
index 0000000000000000000000000000000000000000..eaa4e594dfceffaca51d7b60883f008b39ec6095
--- /dev/null
+++ b/test/mjsunit/harmony/class-privates-evaluation-order.js
@@ -0,0 +1,50 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-class-fields --harmony-private-class-fields
+
+{
+ let effects = [];
+ class C {
+ [effects.push(0)] = effects.push(2);
+ #a = effects.push(3);
+ [effects.push(1)] = effects.push(4);
+ #b = effects.push(5);
+
+ constructor() {
+ effects.push(6);
+ }
+ }
+
+ assertArrayEquals([0, 1], effects);
+ new C;
+ assertArrayEquals([0, 1, 2, 3, 4, 5, 6], effects);
+}
+
+{
+ let effects = [];
+
+ class Base {
+ #a = effects.push(1);
+
+ constructor() {
+ effects.push(2);
+ }
+ }
+
+ class Derived extends Base {
+ #a = effects.push(3);
+
+ constructor() {
+ effects.push(0);
+ super();
+ effects.push(4);
+ }
+ }
+
+ new Derived;
+ assertArrayEquals([0, 1, 2, 3, 4], effects);
+}
+
+// TODO(bakkot) figure out how duplicate fields work
« no previous file with comments | « test/mjsunit/harmony/class-privates-errors.js ('k') | test/mjsunit/harmony/class-privates-proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698