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 --harmony-private-class-fields |
| 6 |
| 7 { |
| 8 let effects = []; |
| 9 class C { |
| 10 [effects.push(0)] = effects.push(2); |
| 11 #a = effects.push(3); |
| 12 [effects.push(1)] = effects.push(4); |
| 13 #b = effects.push(5); |
| 14 |
| 15 constructor() { |
| 16 effects.push(6); |
| 17 } |
| 18 } |
| 19 |
| 20 assertArrayEquals([0, 1], effects); |
| 21 new C; |
| 22 assertArrayEquals([0, 1, 2, 3, 4, 5, 6], effects); |
| 23 } |
| 24 |
| 25 { |
| 26 let effects = []; |
| 27 |
| 28 class Base { |
| 29 #a = effects.push(1); |
| 30 |
| 31 constructor() { |
| 32 effects.push(2); |
| 33 } |
| 34 } |
| 35 |
| 36 class Derived extends Base { |
| 37 #a = effects.push(3); |
| 38 |
| 39 constructor() { |
| 40 effects.push(0); |
| 41 super(); |
| 42 effects.push(4); |
| 43 } |
| 44 } |
| 45 |
| 46 new Derived; |
| 47 assertArrayEquals([0, 1, 2, 3, 4], effects); |
| 48 } |
| 49 |
| 50 // TODO(bakkot) figure out how duplicate fields work |
OLD | NEW |