Index: test/mjsunit/harmony/class-fields-proxy.js |
diff --git a/test/mjsunit/harmony/class-fields-proxy.js b/test/mjsunit/harmony/class-fields-proxy.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b4e8be3addeac63d2f40017e440d333da91348e5 |
--- /dev/null |
+++ b/test/mjsunit/harmony/class-fields-proxy.js |
@@ -0,0 +1,54 @@ |
+// 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 |
+ |
+{ |
+ let effects = []; |
+ let handler = { |
+ defineProperty(){ |
+ effects.push(0); |
+ return true; |
+ }, |
+ get(){ |
+ throw 'called get'; |
+ }, |
+ set(){ |
+ throw 'called set'; |
+ } |
+ }; |
+ |
+ class Base { |
+ constructor(){ |
+ return new Proxy({}, handler); |
+ } |
+ } |
+ |
+ class Derived extends Base { |
+ a = 0; |
+ } |
+ |
+ new Derived; |
+ assertArrayEquals([0], effects); |
+} |
+ |
+{ |
+ let handler = { |
+ defineProperty(){ |
+ throw new Error; |
+ } |
+ }; |
+ |
+ class Base { |
+ constructor(){ |
+ return new Proxy({}, handler); |
+ } |
+ } |
+ |
+ class Derived extends Base { |
+ a = 0; |
+ } |
+ |
+ assertThrows(() => new Derived); |
+} |