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-private-class-fields | |
6 | |
7 // Adding the same property twice | |
8 // TODO(bakkot) instantiating 'Base' should be an error | |
9 { | |
10 class Base { | |
11 constructor() { return new Derived; } | |
12 } | |
13 | |
14 class Derived extends Base { | |
15 #a = 0; | |
16 } | |
Dan Ehrenberg
2016/09/15 21:26:58
This test is a little incomplete, as you don't act
| |
17 } | |
18 | |
19 // Deleting a private field | |
20 // TODO(bakkot) each of these lines should be a syntax error | |
21 { | |
22 class C { #a; m(){ delete #a; } } | |
23 class D { #a; m(){ delete this.#a; } } | |
24 } | |
25 | |
26 // Referencing a private field outside a class | |
27 // TODO(bakkot) this is not spec'd to be a syntax error, but should be | |
28 { | |
29 () => #a; | |
30 () => this.#a; | |
31 } | |
32 | |
33 // Referencing a private field inside a class which doesn't declare it | |
34 // TODO(bakkot) it is unclear whether or not this will be an error, see | |
35 // https://github.com/tc39/proposal-private-fields/issues/49 | |
Dan Ehrenberg
2016/09/15 21:26:58
I think the only ongoing discussion is whether it
| |
36 { | |
37 class C { | |
38 #a; | |
39 m(){ #b; } | |
40 } | |
41 } | |
42 | |
43 // Referencing a private field through 'eval' | |
44 // TODO(bakkot) it is unclear whether or not this will be an error, see | |
45 // https://github.com/tc39/proposal-private-fields/issues/47 | |
46 { | |
47 class C { | |
48 #a = 0; | |
49 m() { return eval('#a'); } | |
50 } | |
51 let c = new C; | |
52 assertEquals(0, c.m()); | |
53 } | |
OLD | NEW |