OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --harmony-class-fields |
| 6 |
| 7 { |
| 8 let effects = []; |
| 9 let handler = { |
| 10 defineProperty(){ |
| 11 effects.push(0); |
| 12 return true; |
| 13 }, |
| 14 get(){ |
| 15 throw 'called get'; |
| 16 }, |
| 17 set(){ |
| 18 throw 'called set'; |
| 19 } |
| 20 }; |
| 21 |
| 22 class Base { |
| 23 constructor(){ |
| 24 return new Proxy({}, handler); |
| 25 } |
| 26 } |
| 27 |
| 28 class Derived extends Base { |
| 29 a = 0; |
| 30 } |
| 31 |
| 32 new Derived; |
| 33 assertArrayEquals([0], effects); |
| 34 } |
| 35 |
| 36 { |
| 37 let handler = { |
| 38 defineProperty(){ |
| 39 throw new Error; |
| 40 } |
| 41 }; |
| 42 |
| 43 class Base { |
| 44 constructor(){ |
| 45 return new Proxy({}, handler); |
| 46 } |
| 47 } |
| 48 |
| 49 class Derived extends Base { |
| 50 a = 0; |
| 51 } |
| 52 |
| 53 assertThrows(() => new Derived); |
| 54 } |
OLD | NEW |