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 |